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
(Your echo test, btw, failed because it would have been (breaking up the parameters) run as /bin/sh, -c, echo, /bin/sh,-c, exec_cmd p1_cmd. All of those arguments after echo got passed as arguments to /bin/sh, and not to echo)
Related questions