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 to modify the docker container storage location

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces you how to modify the docker container storage location, the content is very detailed, interested friends can refer to, hope to be helpful to you.

How to modify the docker container storage location? Sometimes we may need to modify the default storage location of docker. All images and related information of docker are stored at: / var/lib/docker.

View the default docker storage path

Docker info | grep 'Docker Root Dir'WARNING: No swap limit supportDocker Root Dir: / var/lib/docker

Stop all docker containers

Sudo docker stop $(docker ps-a | awk'{print $1}'| tail-n + 2)

Stop the docker service

Sudo service docker stopcd / var/lib

Package the docker directory

Sudo tar-czvf / usr/docker.tar.gz docker/cd / usr/sudo tar-xzvf docker.tar.gz

Modify the default storage location of docker

Sudo vim / etc/docker/daemon.json {"graph": "/ home/server/docker"}

Start the docker service

Sudo service docker start

Start all docker containers

Sudo docker start $(docker ps-a | awk'{print $1}'| tail-n + 2)

View the modified docker storage path

Docker info | grep 'Docker Root Dir'WARNING: No swap limit supportDocker Root Dir: / usr/docker so much about how to modify the storage location of docker containers. 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