Dockerfile’s ENTRYPOINT instruction accepts both string or array as its argument. However, the specified entrypoint won’t take any argument if it is passed as a string. Because of that, it should be an array if the entrypoint is intended to take arguments.

For example, images created by the Dockerfile below do not take any arguments:

FROM debian:11-slim

ENTRYPOINT "/bin/bash" # passing as a string

That’s why the following docker run command does not output anything.

$ docker build . -f Dockerfile.str_entrypoint -t the-image
$ docker run --rm the-image -c "echo hiya"
$ # no output because the entrypoint does not take its args

To take arguments, the entrypoint should be an array like this:

FROM debian:11-slim

ENTRYPOINT ["/bin/bash"] # passing as an array

This time the output should be shown.

$ docker build . -f Dockerfile.arr_entrypoint -t the-image
$ docker run --rm the-image -c "echo hiya" # vertually just running `bash -c echo hiya` on the container
hiya
$

See Also