In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about whether the data in the docker container will be lost. Xiaobian thinks it is quite practical, so share it with you to learn. I hope you can gain something after reading this article. Let's not say much. Let's take a look at it together with Xiaobian.
Will the docker container lose data? There are two ways to persist data in docker containers. (1) Reverse container to mirror image by commit command;(2) Pull data out of container data volume.
The role of container data volume is to persist container data, inherit and share data among containers.
A volume is a directory or file that exists in one or more containers, intercepted by Docker to the container, but is not part of a federated file system, so it can bypass federated file systems to provide some features for persistent storage or sharing of data.
Volumes are designed to persist data independently of the container lifecycle, so Docker does not delete mounted volumes when a container is deleted. The volume persists, even if the container on which the data volume is mounted has been deleted.
Container How to add data volumes
1) Command added
docker run -it -v host absolute path directory: directory in container [:ro] image name
:ro Forcing read-only permissions to be added to this container for shared directories, i.e. shared directories in the container are read-only
-privileged=true Add Shared Directory Error
2) DockerFile added
Create a DockerFile file, add one or more volumes to the image using the VOLUME command in the file, and then use docker build to make it a mirror.
Using docker run to make mirror instances containers
Use docker inspect to view shared addresses corresponding to hosts
The above is whether the data in the docker container will be lost, Xiaobian believes that some knowledge points may be what we will see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.