kaiser
kaiser

Reputation: 135

Display the environment variable inside a docker environment

I am setting my Firebase status in the .env file with Firebase=false. If it is true, some codes will initialize the firebase app. When I try to run the system with docker-compose up and run some functions, it will return the error The default Firebase app does not exist. Make sure to initialize the SDK by calling initialize_app().

To debug it, I have to check if the firebase variable is really false in my docker environment. I tried to run docker exec <container> echo "$Firebase" but it is not displaying anything. Is there any way I can check it?

I also tried docker exec <container ID> bash -c 'echo "$Firebase"' but it also doesn't display anything.

Upvotes: 1

Views: 785

Answers (1)

Nemanja Ranković
Nemanja Ranković

Reputation: 325

You can execute command inside running container using docker exec. More about it here.

docker exec [OPTIONS] CONTAINER COMMAND [ARG...]

As an answer to your question, to display environment variables inside docker container execute following:

docker exec <container ID> env

Upvotes: 1

Related Questions