Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How docker restarts the container

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces docker how to restart the container, the content is very detailed, interested friends can use for reference, I hope it can be helpful to you.

The restart strategy of the docker container is a startup strategy for the production environment, which can be ignored in the development process. The restart of the Docker container is done by the Docker daemon, so it is closely related to the daemon.

The restart strategy for the Docker container is as follows:

No, the default policy, does not restart the container when it exits

On-failure, the container will be restarted only when the container exits abnormally (the exit status is not 0)

On-failure:3, restart the container when it exits abnormally, up to 3 times

Always, always restart the container when it exits

Unless-stopped, which always restarts the container when it exits, but does not consider containers that have been stopped when the Docker daemon starts

View docker container restart policy

Docker inspect Container ID

Docker run-d-- restart=always bba-208docker run-d-- restart=on-failure:10 bba-208

-restart option for docker run

With the-restart option, you can set the container restart policy to determine whether the Docker daemon restarts the container that just exited when the container exits.

The-restart option is usually used only for containers in detached mode.

The-restart option cannot be used with the-rm option. Obviously, the-restart option applies to containers in detached mode, while the-rm option applies to containers in foreground mode.

When docker ps looks at containers, the only possible states for containers that use the-restart option are Up or Restarting.

So much for sharing about how docker restarts the container. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report