From 7cf495874cfb0cafbf24c3c993337c8fa1a7d671 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Fri, 11 Jul 2014 19:50:25 -0400 Subject: [PATCH] Rewrote the ENTRYPOINT section in builder Docker-DCO-1.1-Signed-off-by: James Turnbull (github: jamtur01) --- docs/sources/reference/builder.md | 52 +++++++++++++++++-------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/docs/sources/reference/builder.md b/docs/sources/reference/builder.md index da7f3ebf..58854f5a 100644 --- a/docs/sources/reference/builder.md +++ b/docs/sources/reference/builder.md @@ -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 -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 -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