title: Docker Build fails but Gitlab-CI reports succeeds(False positive)
body: <p>I have a Gitlab pipeline that builds my Docker image from a Dockerfile, but when the &quot;docker build&quot; command fails, the pipeline still reports a success.</p>
  <pre><code>build:
    stage: build
    script:
      - docker build --no-cache -t $CI_REGISTRY/dockerfile:$CONTAINER_LABEL .
  </code></pre>
  <p>I've added an error to my Dockerfile so I can provoke an error:</p>
  <pre><code>FROM ubuntu:20.04   
  RUN not_a_real_command_that_should_fail
  </code></pre>
  <p>The pipeline runs:</p>
  <pre><code>Running with gitlab-runner 14.0.1 (c1edb478)
    on ******* Cy33WtLD
  Preparing the &quot;shell&quot; executor
  00:00
  Using Shell executor...
  Preparing environment
  00:01
  Running on **********...
  Getting source from Git repository
  00:04
  Fetching changes with git depth set to 50...
  Reinitialized existing Git repository in C:/gitlab-runner/builds/Cy33WtLD/0/dockerfile/.git/
  Checking out 999a815d as fix_pipeline_status...
  git-lfs/2.13.2 (GitHub; windows amd64; go 1.14.13; git fc664697)
  Skipping Git submodules setup
  Executing &quot;step_script&quot; stage of the job script
  00:03
  $ docker build --no-cache -t $CI_REGISTRY/dockerfile:$CONTAINER_LABEL .
  #1 [internal] load build definition from Dockerfile
  #1 sha256:c544637cbaca3e93c2a8a8c00efd4f81ee45b1abd410d971af12de8dae21e8ea
  #1 transferring dockerfile: 3.04kB done
  #1 DONE 0.0s
  #2 [internal] load .dockerignore
  #2 sha256:ab745a167b371ba5e9380063cb278a7792a5838550b89f02f35d7f6a583fb548
  #2 transferring context: 2B done
  #2 DONE 0.0s
  #3 [internal] load metadata for docker.io/library/ubuntu:20.04
  #3 sha256:8e67b796a66f85f06793e026943184e32d365c77929e94d2ac98b34a1e1cb30e
  #3 DONE 0.6s
  #4 [ 1/17] FROM docker.io/library/ubuntu:20.04@sha256:9d6a8699fb5c9c39cf08a0871bd6219f0400981c570894cd8cbea30d3424a31f
  #4 sha256:c8b7f784dc481f981cf0bc39c4d4e60a54a355d96ca108a13ffffa3bfa047067
  #4 CACHED
  #20 [internal] load build context
  #20 sha256:d12ef8e847404a2cc9437d8099f4b73f215c48eb92002e759a5f264989ae3ace
  #20 transferring context: 92B 0.0s done
  #20 DONE 0.0s
  #5 [ 2/17] RUN not_a_real_command_that_should_fail
  #5 sha256:724c85340f260555ab116f9064ba3c7a2c16fe0af059ef5226df31545b30ddb6
  #5 0.485 /bin/sh: 1: not_a_real_command_that_should_fail: not found
  #5 ERROR: executor failed running [/bin/sh -c not_a_real_command_that_should_fail]: exit code: 127
  ------
   &gt; [ 2/17] RUN not_a_real_command_that_should_fail:
  ------
  executor failed running [/bin/sh -c not_a_real_command_that_should_fail]: exit code: 127
  Cleaning up file based variables
  00:01
  Job succeeded
  </code></pre>
  <p>The exit code is 127, I've added a -after_stage step to print out the return code &quot;echo $?&quot; and get &quot;true&quot; result back. Seems like this should be sufficient for the command to trigger a failure in the pipeline.
  The gitlab-runner is a shell executor on a Windows-machine, if that matters.</p>
  <p>Any suggestions?</p>