How to change the docker storage directory
Background of the article:
In the development environment, because the docker test server runs too many containers and images, the disk space is often filled up. So now I decided to change the docker storage directory to the new mount point.
(Learning video sharing: Programming video)
1. Check Docker disk usage
docker system df
2. Clean the disk
docke system prune
Delete useless data volumes of closed containers and network untagged images -a parameter Useless images will also be deleted (use with caution)
3. Stop the Docker service
systemctl stop docker
4 , Migrate data directory
rsync -avz /var/lib/docker /data/docker/lib/
/var/lib/docker: docker default data directory/var/lib/docker: target directory, you need to create it before execution
5. Configure mapper File
Modify according to the installation configuration file of the docker service
vi /usr/lib/systemd/system/dokcer.service
Add attributes in ExectStart=xxx
ExectStart=xxx --graph /data/docker/lib/docker
Re-update the docker service
systemctl disable docker systemctl enable docker systemctl daemon-reload systemctl start docker
6 . Check
docker info
and you will see the following information indicating success.
Docker Root Dir: /data/docker/lib/docker
Execute docker images and you will see that all previous images have been synchronized.
Related recommendations: docker tutorial
The above is the detailed content of How to change the docker storage directory. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

About efficient use of CMD commands in Dockerfile Many new Docker users are using CMD...

Problem introduction: In Zen projects deployed using Docker, users often encounter version upgrade problems. This article will explain in detail how to get from Zen version 17.8...

Using Docker to containerize, deploy and manage applications on CentOS can be achieved through the following steps: 1. Install Docker, use the yum command to install and start the Docker service. 2. Manage Docker images and containers, obtain images through DockerHub and customize images using Dockerfile. 3. Use DockerCompose to manage multi-container applications and define services through YAML files. 4. Deploy the application, use the dockerpull and dockerrun commands to pull and run the container from DockerHub. 5. Carry out advanced management and deploy complex applications using Docker networks and volumes. Through these steps, you can make full use of D

Dockerfile Best Practice for Building LNMP Environment Learning During Docker, many developers try to build their own LNMP (Linux, Nginx, MySQL, PHP)...

Docker is a must-have skill for DevOps engineers. 1.Docker is an open source containerized platform that achieves isolation and portability by packaging applications and their dependencies into containers. 2. Docker works with namespaces, control groups and federated file systems. 3. Basic usage includes creating, running and managing containers. 4. Advanced usage includes using DockerCompose to manage multi-container applications. 5. Common errors include container failure, port mapping problems, and data persistence problems. Debugging skills include viewing logs, entering containers, and viewing detailed information. 6. Performance optimization and best practices include image optimization, resource constraints, network optimization and best practices for using Dockerfile.

The steps to containerize and deploy Yii applications using Docker include: 1. Create a Dockerfile and define the image building process; 2. Use DockerCompose to launch Yii applications and MySQL database; 3. Optimize image size and performance. This involves not only specific technical operations, but also understanding the working principles and best practices of Dockerfile to ensure efficient and reliable deployment.

DockerVolumes ensures that data remains safe when containers are restarted, deleted, or migrated. 1. Create Volume: dockervolumecreatemydata. 2. Run the container and mount Volume: dockerrun-it-vmydata:/app/dataubuntubash. 3. Advanced usage includes data sharing and backup.
