Answers: <p>@goulashsoup has good advice...
  so, if you mean, how to inspect environment variables in a running container, then do:</p>
  <pre><code>docker exec -u root $CONTAINER_ID sh -c &quot;env | sort&quot;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2024-06-25T13:10:35.263Z
Answers: okay got it, thanks
Answers: void_meet
Answers: CC BY-SA 4.0
Answers: 2024-06-24T14:30:41.307Z
Answers: 2024-06-24T14:30:41.307Z
Answers: mikequentel
Body: <p>I am unable to get all the env variables even after the <code>docker inspect &lt;container_id&gt;</code> command it just shows only this much when I inspected the mongo:4 image.</p>
  <pre><code>                &quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&quot;,
                  &quot;GOSU_VERSION=1.17&quot;,
                  &quot;JSYAML_VERSION=3.13.1&quot;,
                  &quot;MONGO_PACKAGE=mongodb-org&quot;,
                  &quot;MONGO_REPO=repo.mongodb.org&quot;,
                  &quot;MONGO_MAJOR=4.4&quot;,
                  &quot;MONGO_VERSION=4.4.29&quot;,
                  &quot;HOME=/data/db&quot;],```
  so how to get all the env variables available for the particular image? 
  </code></pre>
  
Comments: CC BY-SA 4.0
Comments: 2024-06-24T12:03:17.793Z
Comments: Do you strictly need them before creating a container? Otherwise you could create a container and run `env` on it...
Comments: goulashsoup
Comments: CC BY-SA 4.0
Comments: 2024-06-25T13:10:10.150Z
Comments: Guess that will help
Comments: void_meet
Tags: <docker><environment-variables><mongodb>
Title: How to get all the env variables of any docker image?
UserDisplayName: void_meet
ThreadText: # How to get all the env variables of any docker image?
  
  (Asked by: username_0 on 2024-06-24)
  
  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? 
  
  ```
  
  **Tags:** docker, environment-variables, mongodb
  
  > **Comments:**
  > **username_1**: Do you strictly need them before creating a container? Otherwise you could create a container and run `env` on it...  
  > **username_0**: Guess that will help  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2024-06-24. Score: 1
  
  @username_1 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"
  
  ```
  
  > **Comments:**
  > **username_0**: okay got it, thanks  
  
  ---
  
  