Get Environment Variable from Docker Container

后端 未结 10 1982
花落未央
花落未央 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条回答
  •  Happy的楠姐
    2020-12-12 11:53

    One more since we are dealing with json

    docker inspect  | jq '.[] | .Config.Env'
    

    Output sample

    [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
      "NGINX_VERSION=1.19.4",
      "NJS_VERSION=0.4.4",
      "PKG_RELEASE=1~buster"
    ]
    

提交回复
热议问题