In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "what to do if the docker container is hung up". Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what to do if the docker container hangs up"!
Will the docker container hang up? The docker container may hang up, such as the container started by docker run. What worries us most about the failure of containers is the problem of data. Here's an example.
In a certain system, the functional service is started using docker stack deploy xxx, the service of a database is started using docker run xxx alone, and the database service does not mount the storage location; as a result, when you restart the server and log in to the server to restart the service, it is found that the data in the previous database may disappear (if you start it using docker run again).
Solution 1
When data is lost, the most direct idea is to reverse the data again, but this is a lot of work. The next time you boot, mount the storage to the hard drive. But there is also a simpler way.
Solution 2
You can use docker start container_name to start the container again so that the data is still there. But this is only a temporary solution.
The image initiated by docker, if the data is not mapped out, will be stored in the default volume;, even if the container is restarted with docker restart xxx, the changed data will still be there.
In other words, when the server restarts and the container dies (use docker ps to check, the container status is Exited), but in fact, the previous data will still be under the default volume, and the changed data will be lost only when the container is deleted.
Actually, the best way is to mount the storage directory of the container. In addition, in general, database services should not be started using containers.
At this point, I believe you have a deeper understanding of "what to do when the docker container is hung up". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.