Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c7f5ee9

Browse files
author
Jessie Frazelle
committed
Merge pull request moby#10816 from SvenDowideit/docker-build-return-code
Add some information about the docker build return code
2 parents 87a8658 + d15f8fe commit c7f5ee9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • docs/sources/reference/commandline

docs/sources/reference/commandline/cli.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,29 @@ If you use STDIN or specify a `URL`, the system places the contents into a
537537
file called `Dockerfile`, and any `-f`, `--file` option is ignored. In this
538538
scenario, there is no context.
539539

540+
### Return code
541+
542+
On a successful build, a return code of success `0` will be returned.
543+
When the build fails, a non-zero failure code will be returned.
544+
545+
There should be informational output of the reason for failure output
546+
to `STDERR`:
547+
548+
```
549+
$ docker build -t fail .
550+
Sending build context to Docker daemon 2.048 kB
551+
Sending build context to Docker daemon
552+
Step 0 : FROM busybox
553+
---> 4986bf8c1536
554+
Step 1 : RUN exit 13
555+
---> Running in e26670ec7a0a
556+
INFO[0000] The command [/bin/sh -c exit 13] returned a non-zero code: 13
557+
$ echo $?
558+
1
559+
```
560+
561+
### .dockerignore file
562+
540563
If a file named `.dockerignore` exists in the root of `PATH` then it
541564
is interpreted as a newline-separated list of exclusion patterns.
542565
Exclusion patterns match files or directories relative to `PATH` that

0 commit comments

Comments
 (0)