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