profile
viewpoint

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:

  1. The following Dockerfile does not build:
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
#
  1. command output conflicts with argument(s?) to 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.

  1. The table at https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact needs to be updated. Specifically the 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
docker/docker.github.io

Answer questions jf

Now no external dependencies are needed to play with all combinations of ENTRYPOINT and CMD.

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.

useful!

Related questions

Typo in daemon.json configuration hot 1
Fedora repo link fail to sync hot 1
Golang SDK samples do not work hot 1
Docker EE + Windows Server 2016 + Linux containers? hot 1
Interlock docs missing some configuration options hot 1
Docker MS SQL exited with code 4294967295 hot 1
Installation not working on Ubuntu 19.10 hot 1
"docker-machine create" using Hyper-V driver generates IPv6 address hot 1
Mac OSX daemon.json Location hot 1
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz: could not connect to server (check repositories file) hot 1
BUG getting 403 while attempting to download docker-ce hot 1
Error: invalid mount config for type "bind": bind source path does not exist hot 1
docker failed to start using gluster volume hot 1
source:https://uonfu.com/
Github User Rank List