Docker move overlay2

Leave a comment

May 20, 2019 by aubreykloppers

URGENT: Backup/Restore! Enough said…

If you are like me and using docker, you might find yourself running out of disk space on your root partition due to the way docker works.  The problem is that the “/var/lib/docker/overlay2” files will eventually make your root partition run out of space.  This is due to the fact that the way linux is written, you are not suppose to use the root partition for data and storage.  The fix is actually very easy and this should be the standard of the docker package, at least they, docker, should warn you…

Here is the fix:

edit your “/etc/docker/deamon.json” file and change the “data-root” option.

default file looks like this:


after edit it should look like this:

“data-root”: “/srv/dev-disk-by-label-20TB/docker-lib”

Then move all the content of “/var/lib/docker” to “/srv/dev-disk-by-label-20TB/docker-lib”

cd /var/lib/docker
cp -r * /srv/dev-disk-by-label-20TB/docker-lib/
cd /var/lib
mv docker docker-old

For good measure your can “chmod -R 777” the new folder…

You can then, once everything is up and running 100% remove the old docker folder from the /var/lib folder.

Read more here: MORE HERE…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

counter for wordpress
%d bloggers like this: