I have Docker installed on a MacOS, when starting the Docker application my containers are starting automatically. How do I prevent this automatic start behavior?
I have Docker installed on a MacOS, when starting the Docker application my containers are starting automatically. How do I prevent this automatic start behavior?
According to the official documentation when setting the - restart = always I'll be setting up an automatic restart in the event of a stop, whether forced or not. This means that if I shut down the machine and turn it on again, when starting a Docker process the container will be started together.
To prevent this, I can simply omit - restart = from my docker-compose.yml, because by default this option is equal to in (not start automatically).
Another alternative would be to update this option directly in the container settings:
docker update --restart=no meu-container
or
docker update --restart=on-failure meu-container
In the latter case, restart will only occur if the container exits with a non-zero return code.