Home > OS >  How does Docker-Desktop behave when a container, initially executed with docker-compose and argument
How does Docker-Desktop behave when a container, initially executed with docker-compose and argument

Time:01-28

Let's say I have a complex container that I start with the following command:

docker-compose --env-file ./src/.env -f docker-compose.yml -f docker-compose.dev.yml up --build

As you can see, I use a custom .env file and override my docker-compose.yml file with another one. What happens in Docker-Desktop when I restart my container? I ask because those flags don't seem to be reused when I restart my container, at least for my .env file.

CodePudding user response:

The environment variables of your env file are added to the container at creation time (docker compose up). Afterwards, they're assigned to your container and you can inspect them with the docker inspect command. They are not removed at container restart, however they will be lost when you recreate the container without passing the env file again.

  • Related