0

I am unable to get all the env variables even after the docker inspect <container_id> command it just shows only this much when I inspected the mongo:4 image.

                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.17",
                "JSYAML_VERSION=3.13.1",
                "MONGO_PACKAGE=mongodb-org",
                "MONGO_REPO=repo.mongodb.org",
                "MONGO_MAJOR=4.4",
                "MONGO_VERSION=4.4.29",
                "HOME=/data/db"],```
so how to get all the env variables available for the particular image? 
2
  • 1
    Do you strictly need them before creating a container? Otherwise you could create a container and run env on it... Commented Jun 24 at 12:03
  • Guess that will help
    – void_meet
    Commented Jun 25 at 13:10

1 Answer 1

0

@goulashsoup has good advice... so, if you mean, how to inspect environment variables in a running container, then do:

docker exec -u root $CONTAINER_ID sh -c "env | sort"
1
  • okay got it, thanks
    – void_meet
    Commented Jun 25 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.