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

£可爱£侵袭症+ 提交于 2019-11-30 06:58:22

问题


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?


回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/26711103/docker-changing-var-lib-docker-aufs-diff-location

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!