Get Environment Variable from Docker Container

后端 未结 10 1971
花落未央
花落未央 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:54

    You can use printenv VARIABLE instead of /bin/bash -c 'echo $VARIABLE. It's much simpler and it does not perform substitution:

    docker exec container printenv VARIABLE
    

提交回复
热议问题