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

The method of backing up container data in docker

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

Share

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

What are the ways to back up container data in docker? Docker can use volume storage (Volume) to persist and back up files in the host. Volumes are stored in part of the host file system managed by Docker (/ var/lib/docker/volumes/ on Linux).

Container backup data volume

1. Create a data volume named dbvolume and mount it in the / dbdate directory called dbstore container.

Docker run-d-name dbstore-v dbvolume:/dbdata alpine sh

two。 Write data to a dbvolume volume

[root@node2 ~] # docker exec-it dbstore sh/ # echo hello > / dbdata/test.txt/ # exit

3. Back up the data volumes in the container

[root@node2] # docker run-- rm-- volumes-from dbstore-v $(pwd): / backup alpine tar cvf / backup/backup.tar / dbdatatar: removing leading'/ 'from member namesdbdata/dbdata/test.txt

This is the end of the method of backing up container data in docker. I hope the above content can be of some reference value and can be put into practice. If you like this article, you might as well 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