Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker changing /var/lib/docker/aufs/diff location

Docker folder /var/lib/docker/aufs/diff grows too much and I would like to move it on an other partition. Is there a way to configure Docker to use another location for this foder?

like image 980
guillaume Avatar asked Nov 03 '14 09:11

guillaume


People also ask

What is docker AUFS diff?

A diff in Docker terms is simply the difference in filesystem. Like git, it takes an initial read only image and builds the final container by layering your diffs. Everytime you do something in the container it creates a change in the layer which may be commited to a new image via docker commit.


2 Answers

There's an easy way to get the docker daemon to handle this for you.

stop docker

$ service docker stop

add this line to /etc/default/docker

# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="-g /<new destination>/docker/"

start docker

$ service docker start

verify the docker files and folders are created in the new destination

remove /var/lib/docker

/var/lib$ sudo rm -rf docker
like image 66
Paul S Avatar answered Oct 21 '22 06:10

Paul S


There is an answer on this thread, basically a ln -s, after some preparatory work

docker ps -q | xargs docker kill
stop docker
cd /var/lib/docker/devicemapper/mnt
umount ./*
mv /var/lib/docker $dest
ln -s $dest /var/lib/docker
start docker

https://github.com/docker/docker/issues/3127#issuecomment-30095645

like image 28
user2915097 Avatar answered Oct 21 '22 04:10

user2915097