简体   繁体   中英

Disable docker image being run as daemon (restart always policy)

Every time I start the docker daemon (via systemctl start docker.service ), a bunch of images start running from a docker-compose config that I previously run.

How can I disable them from starting up when the docker daemon starts up?

I haven't been able to find any resources for this.

Each container has a restart policy that stats what is about to happen when it terminates. Here is an article about that. The following command gives you an overview of all of your containers with their restart policy:

docker inspect -f "{{.Name}} {{.HostConfig.RestartPolicy.Name}}" `docker ps -aq`

If you don't need these containers anymore removing them is probably the best solution. Therefore, you have to execute docker-compose rm with your compose file. You could also use docker-compose stop to indicate that you don't want the service around anymore.

docker update --restart=no containerId
docker stop containerId

Replace containerId with the appropriate value

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM