Get Environment Variable from Docker Container

后端 未结 10 1972
花落未央
花落未央 2020-12-12 11:12

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

10条回答
  •  [愿得一人]
    2020-12-12 11:51

    The proper way to run echo "$ENV_VAR" inside the container so that the variable substitution happens in the container is:

    docker exec  bash -c 'echo "$ENV_VAR"'
    

提交回复
热议问题