docker修改默认的容器目录/var/lib/docker

修改 /lib/systemd/system/docker.service

修改 ExecStart=/usr/bin/dockerd -H fd://
成: ExecStart=/usr/bin/dockerd -g /home/docker -H fd://

停掉docker

systemctl stop docker ps aux | grep -i docker | grep -v grep

重加载 systemd daemon

systemctl daemon-reload

建目录

mkdir /home/docker rsync -aqxP /var/lib/docker/ /home/docker

启动docker

systemctl start docker

查看是否使用新的目录

docker info|grep Root WARNING: No swap limit support
Root Dir: /home/docker/aufs
Docker Root Dir: /home/docker

全文完