Home > Software engineering >  Is there a way to prevent all the Docker containers within a service from auto restarting or startin
Is there a way to prevent all the Docker containers within a service from auto restarting or startin

Time:03-18

I am currently using Docker Desktop.

However, I have built services using the docker-compose up command. I have noticed that whenever we start Docker Desktop, the containers attached to each service automatically starts. Is there a way to prevent this?

I know that it is possible to set the restart policy of each container. But I don't know how to do this when there are multiple containers. Also multiple services may be using a container of the same name.

What I need is to prevent these services from starting and their containers.

CodePudding user response:

You can use either of these commands to update your docker

docker update --restart=no the-container-you-want-to-disable-restart

docker update --restart=no $(docker ps -a -q)

  • Related