How can I get the docker run parameters inside a container?

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 $1 or 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:

# I am
if [ "$1" = "the_daemon" ]
  echo "You are about to run the_daemon.  Arguments:"
  echo "$@"
exec "$@"
# I am the Dockerfile.
FROM ubuntu:16.04
RUN apt-get install the_daemon && apt-get clean
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

hi @pebbe, did you find how solve this issue.
I have same requirement as you.

Bump! Me too.

I particularly want to know if run was passed -d so my can make a decision based on it.