Ask questionsnotes for "Shell form ENTRYPOINT example" need to be cleaned up
File: engine/reference/builder.md
These points relate to https://docs.docker.com/engine/reference/builder/#shell-form-entrypoint-example. Several points:
FROM ubuntu
ENTRYPOINT top -b
CMD --ignored-param1
# docker build -t top .
Sending build context to Docker daemon 70.14kB
Error response from daemon: Dockerfile parse error line 6: Unknown flag: ignored-param1
#
docker run in the example given:$ docker run -it --name test top --ignored-param2
Mem: 1704184K used, 352484K free, 0K shrd, 0K buff, 140621524238337K cached
CPU: 9% usr 2% sys 0% nic 88% idle 0% io 0% irq 0% sirq
Load average: 0.01 0.02 0.05 2/101 7
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
1 0 root S 3168 0% 0% /bin/sh -c top -b cmd cmd2
7 1 root R 3164 0% 0% top -b
Command gives --ignored-param2, while output uses cmd cmd2. This is besides the fact that the container's output from top does not reveal the command line arguments for both sh and top; you need to use docker top test for that.
ENTRYPOINT exec_entry p1_entry, with CMD exec_cmd p1_cmd entry. I get /bin/sh -c exec_entry p1_entry sh -c exec_cmd p1_cmd
Answer
questions
jf
Now no external dependencies are needed to play with all combinations of
ENTRYPOINTandCMD.
this is great! thanks.
At least the shell form prevents the CMD to be used. A second /bin/sh normally doesn't make sense in the command line, but of course depends on what the entrypoint does with it.
Surely the shell form still does something with the CMD provided in the Dockerfile? That was my point and why I say the documentation isnt really correct.
I you like you could draft a PR to update the table in docker/cli repo.
Thanks. I can. Just not too sure about (as I've said) whether this is a bug in the doc, or if the behaviour has changed.
Related questions