Modify the docker default storage location

The storage space of the container is insufficient, and its storage location needs to be changed to another place. There are three methods on the Internet. After testing one by one, I found that, um... the simplest method is the best and the least error-prone.

1. Stop the docker service

systemctl stop docker

2. Create a new directory

mkdir /media/xxx/docker

3. Move, if you are not at ease, you can delete /var/lib/docker after cp is finished

mv /var/lib/docker /media/xxx/docker

4. Soft chain

ln -s /media/xxx/docker/* /var/lib/docker

Pit : When using ln -s /media/xxx/docker /var/lib/docker to start docker, it failed, and the path could not be found at all. Searched for various solutions, but couldn't make it start successfully. After trying this method, it can be successfully started, and the storage location can be changed.

Guess you like

Origin blog.csdn.net/m0_59029800/article/details/127903305