Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to modify the docker container storage location

Shulou Source: shulou.com Published: 2022-06-01 03:33:06 10月04日 Update

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.

Tags: Storage location container content more path help service good information interest guy buddy article sometimes catalog knowledge article reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology NVidia Microsoft macOS