Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable autostart of docker-compose project

I have a docker-compose project using Docker for Mac that autostarts when I boot the computer.

I usually start the project with docker-compose up -d, but even running docker-compose stop before shutting down autostarts it again on boot.

I am not aware of specifically enabling this. How can I disable it?

like image 967
Harald Nordgren Avatar asked Dec 08 '16 09:12

Harald Nordgren


People also ask

How do I stop docker from automatically starting?

Click the Docker icon in the menu bar. Select Preferences... (or press Cmd-comma). Deselect 'Start Docker when you log in' on the General tab.

Does docker compose auto restart?

Like the restart Docker command, Docker Compose includes the restart property to restart containers automatically.

How do I stop docker compose up?

Start Docker Containers In the Foreground In this case, the application will be up and running until you hit Ctrl-C to cancel the foreground process. In this case, when you press Ctrl-C, it is equivalent to executing the “docker-compose stop”. So, it will stop all the containers gracefully.

How do I run docker compose up at startup?

Use restart: always in your docker compose file. Docker-compose up -d will launch container from images again. Use docker-compose start to start the stopped containers, it never launches new containers from images. You may not want to use always , but maybe unless-stopped .


1 Answers

Today I had the same issue that all containers are started when I boot my dev laptop, as restart: always was set in the .yml files.

As I don't want to touch the .yml files, I just found out (thx Bobby) how to alter this setting by:

docker update --restart=no <MY-CONTAINER-ID> 
like image 117
davey Avatar answered Sep 22 '22 21:09

davey