What\'s the simplest way to get an environment variable from a docker container that has not been declared in the Dockerfile?
For instance, an environment v
We can modify entrypoint
of a non-running container with the docker run
command.
Example show PATH environment variable:
using bash
and echo
: This answer claims that echo
will not produce any output, which is incorrect.
docker run --rm --entrypoint bash -c 'echo "$PATH"'
using printenv
docker run --rm --entrypoint printenv PATH