I’ve started to use docker, and thus containers, a lot more recently.
One thing I have noticed is once a container has been created, when I start my computer up it auto starts the containers. Now, while good for some, I simply don’t want all my dev Docker containers auto starting. So how do we stop this… well… read on.
If the RestartPolicy of the container is set to always then it will restart, you can check this by typing
docker inspect my-container
Look for the RestartPolicy section in the output
To change the policy, type:
docker update --restart=no my-container
Where my-container is your container name.
Thats it, when you restart your computer your container will no longer auto start.