Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto start docker containers in Docker for mac?

Docker Desktop for Mac restarts every time my laptop wakes up and I have to manually start all my containers by docker start <container>. Is there a way to do it automatically?

like image 204
gennad Avatar asked Aug 10 '16 14:08

gennad


1 Answers

You can try and run your containers with the --restart always policy.
See docker run Restart policies.

Always restart the container regardless of the exit status.
When you specify always, the Docker daemon will try to restart the container indefinitely.
The container will also always start on daemon startup, regardless of the current state of the container.

That way, when the docker daemon restart, all containers previously launched with that option should run again.

like image 138
VonC Avatar answered Oct 07 '22 01:10

VonC