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.

so how to get all the env variables available for the particular image? 
  • 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


@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"
  • 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.