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 modifying the storage location of Docker local image and container

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

Share

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

Soft link

The default location for Docker is / var/lib/docker.

Command to view the specific location

Docker info | grep "Docker Root Dir"

The easiest way is to mount the partition to this directory. Because there is data in the data disk, modify the storage path of the image and container to achieve the goal. It is realized through soft connection.

Stop the Docker service:

Systemctl stop docker

Move the entire / var/lib/docker directory to the destination path:

Mv / var/lib/docker / root/data/docker / root/data/docke is the mounted disk ln-s / root/data/docker / var/lib/docker / / soft connection pointing to

When you start Docker, you find that the storage directory is still / var/lib/docker, but it is actually stored on the data disk, and you can see the capacity change on the data disk.

Systemctl start dockerdf-hT / / Mount docker info | grep "Docker Root Dir" / / you can see the path

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