简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM