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?
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.
Like the restart Docker command, Docker Compose includes the restart property to restart containers automatically.
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.
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 .
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With