How to prevent automatic container start-up when starting Docker

Asked

Viewed 1,338 times

-1

I have Docker installed on a Macos, when starting the Docker application my containers are being started automatically. How do I stop this auto start behavior?

  • 1

    Check for help: https://stackoverflow.com/a/40513690/6510304

1 answer

1


According to the official documentation when setting the parameter --Restart= Always I will be setting up an automatic re-start in case of a stop, whether forced or not. This means that if I turn the machine off and on again, when starting a Docker process the container will start together.

To prevent that I can simply omit --re-start= from my Docker-Compose.yml, as by default this option is equal to in the (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 last case, only re-start will occur if the container exits with a non-zero return code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.