How can I test inside a container what run parameters were used to start the container?
This seems a little bit tautological: the parameters used to start the container become the command-line parameters to the program the container runs, so it looks at its
sys.argv or whatever.
A typical technique is to use a shell script to do some initial setup, and that can also do things with the arguments:
#!/bin/sh # I am entrypoint.sh. if [ "$1" = "the_daemon" ] echo "You are about to run the_daemon. Arguments:" echo "$@" fi exec "$@"
# I am the Dockerfile. FROM ubuntu:16.04 RUN apt-get install the_daemon && apt-get clean COPY entrypoint.sh / ENTRYPOINT /entrypoint.sh CMD the_daemon
Does that help?
I don’t mean the parameters to the program run in Docker, but the parameters to
docker run itself, the parameters you see when you run
docker run --help