Strange behavior when getting env var in container

I need to get an env var from an docker container. This build is triggered with a docker compose file and I passed also the env variables with env_file. When I login to the container with

docker exec -it conatinerName bash

I can echo the variable and get correct output. Even when I trigger

docker exec -it containerName echo $DEBUG

inside the poetry environment, I get the correct answer. When I trigger this command from a terminal session without acitvated environment I get nothing.

For me its very confusing, because I thought my docker container has nothing to do with my poetry environment. I just want to get the env var($DEBUG) from inside the container undependend the location I trigger this command.

Back to Top