Rewrote the ENTRYPOINT section in builder

Docker-DCO-1.1-Signed-off-by: James Turnbull <james@lovedthanlost.net> (github: jamtur01)
master
James Turnbull 2014-07-11 19:50:25 -04:00 committed by Tibor Vass
parent 1bb925be97
commit 7cf495874c
1 changed files with 29 additions and 23 deletions

View File

@ -374,41 +374,47 @@ The copy obeys the following rules:
ENTRYPOINT has two forms:
- `ENTRYPOINT ["executable", "param1", "param2"]`
(like an *exec*, preferred form)
(like an *exec*, the preferred form)
- `ENTRYPOINT command param1 param2`
(as a *shell*)
There can only be one `ENTRYPOINT` in a Dockerfile. If you have more than one
`ENTRYPOINT`, then only the last one in the Dockerfile will have an effect.
There can only be one `ENTRYPOINT` in a `Dockerfile`. If you have more
than one `ENTRYPOINT`, then only the last one in the `Dockerfile` will
have an effect.
An `ENTRYPOINT` helps you to configure a container that you can run as an
executable. That is, when you specify an `ENTRYPOINT`, then the whole container
runs as if it was just that executable.
An `ENTRYPOINT` helps you to configure a container that you can run as
an executable. That is, when you specify an `ENTRYPOINT`, then the whole
container runs as if it was just that executable.
The `ENTRYPOINT` instruction adds an entry command that will **not** be
overwritten when arguments are passed to `docker run`, unlike the behavior
of `CMD`. This allows arguments to be passed to the entrypoint. i.e.
`docker run <image> -d` will pass the "-d" argument to the ENTRYPOINT.
Unlike the behavior of the `CMD` instruction, The `ENTRYPOINT`
instruction adds an entry command that will **not** be overwritten when
arguments are passed to `docker run`. This allows arguments to be passed
to the entry point, i.e. `docker run <image> -d` will pass the `-d`
argument to the entry point.
You can specify parameters either in the ENTRYPOINT JSON array (as in
"like an exec" above), or by using a CMD statement. Parameters in the
ENTRYPOINT will not be overridden by the `docker run`
arguments, but parameters specified via CMD will be overridden
by `docker run` arguments.
You can specify parameters either in the `ENTRYPOINT` JSON array (as in
"like an exec" above), or by using a `CMD` instruction. Parameters in
the `ENTRYPOINT` instruction will not be overridden by the `docker run`
arguments, but parameters specified via a `CMD` instruction will be
overridden by `docker run` arguments.
Like a `CMD`, you can specify a plain string for the `ENTRYPOINT` and it will
execute in `/bin/sh -c`:
Like a `CMD`, you can specify a plain string for the `ENTRYPOINT` and it
will execute in `/bin/sh -c`:
FROM ubuntu
ENTRYPOINT wc -l -
ENTRYPOINT ls -l
For example, that Dockerfile's image will *always* take STDIN as input
("-") and print the number of lines ("-l"). If you wanted to make this
optional but default, you could use a CMD:
For example, that `Dockerfile`'s image will *always* take a directory as
an input and return a directory listing. If you wanted to make this
optional but default, you could use a `CMD` instruction:
FROM ubuntu
CMD ["-l", "-"]
ENTRYPOINT ["/usr/bin/wc"]
CMD ["-l"]
ENTRYPOINT ["/usr/bin/ls"]
> **Note**:
> It is preferable to use the JSON array format for specifying
> `ENTRYPOINT` instructions.
## VOLUME