docker默认路径

$docker info

查看

需要修改为新的路径,但是unbuntu修改配置文件:

sudo vim /etc/default/docker

DOCKER_OPTS="--graph /home/zy/docker"

没有生效.


$ ps -ef | grep docker 看启动参数,没有生效


谷歌发现,需要修改:

sudo vim /lib/systemd/system/docker.service


[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
EnvironmentFile=-/etc/default/docker                                        --增加配置文件生效
ExecStart=/usr/bin/docker daemon $DOCKER_OPTS -H fd://     --增加启动参数
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes

执行命令:
systemctl daemon-reload  

sudo service docker restart

$docker info

发现已经修改成功