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

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

Share

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

This article mainly explains "how to modify the storage location of Docker local images and containers in linux". The explanation in this article is simple and clear and easy to learn and understand. please follow the editor's ideas to study and learn "how to modify the storage location of Docker local images and containers in linux".

Method: soft link

By default, the location of Docker is: / var/lib/docker

You can view the location with the following command:

[root@omisclass ~] # docker info | grep "Docker Root Dir" WARNING: You're not using the default seccomp profileDocker Root Dir: / var/lib/docker

Of course, the most direct way to solve this problem is to mount the partition to this directory, but there are other things on my data disk, which must be difficult to manage, so change the storage path of the image and container to achieve the goal.

This method will be implemented through soft connections.

First stop the Docker service:

Systemctl stop docker.service

Then move the entire / var/lib/docker directory to the destination path:

Mv / var/lib/docker / root/data/dockerln-s / root/data/docker / var/lib/dockersystemctl restart docker

At this time, 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.

Thank you for reading, the above is the content of "how to modify the storage location of Docker local image and container in linux". After the study of this article, I believe you have a deeper understanding of how to modify the storage location of Docker local image and container in linux. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report