Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/570e00d5d18ee4e69eca to your computer and use it in GitHub Desktop.
Save RichardBronosky/570e00d5d18ee4e69eca to your computer and use it in GitHub Desktop.
Your Dockerfile ENTRYPOINT's dirty little secret.
FROM ubuntu
# Works the same on Centos too if you want to try it. ;-)
# "Shell Form"
# Don't do this. it fails to accept arguments from the docker cli
ENTRYPOINT cat
# "Exec Form"
# This is what you want. Even if the "Shell Form" seems to work for you. (See the transcript below.)
ENTRYPOINT ["cat"]
# NOTE: According to https://docs.docker.com/reference/builder/#entrypoint
# "Only the last ENTRYPOINT instruction in the Dockerfile will have an effect."
docker build -t myimage .
echo -ne 'asdf\n\nqwer\n\n' | docker run -i myimage -e
## Shell Form output (the ENTRYPOINT does not receive the "-e" argument)
echo -ne 'asdf\n\nqwer\n\n' | docker run -i myimage -e
asdf
qwer
## Exec Form output (the ENTRYPOINT receives the "-e" argument)
echo -ne 'asdf\n\nqwer\n\n' | docker run -i myimage -e
asdf$
$
qwer$
$
## Rationale
~# echo -ne 'asdf\n\nqwer\n\n' | cat -e
asdf$
$
qwer$
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment