问题
I am using Fedora 22 and I must change my Docker image directory from
/var/lib/docker
to
/home/my_user/docker
Following this How to change the docker image installation directory? I edited the /etc/sysconfig/docker adding:
other_args="-g /home/rseixas/Programs/Docker/images"
I restarted the service but no change. In fact I restarted my machine and I am not able to see it changing.
Someone can help me?
回答1:
Do you have a /lib/systemd/system/docker.service
file?
If so, edit it so that the Docker service uses the usual /etc/default/docker
as an environment file: EnvironmentFile=-/etc/default/docker
.
In the /etc/default/docker
file then add DOCKER_OPTS="-g /home/rseixas/Programs/Docker/images"
.
At the end just do a systemctl daemon-reload && systemctl restart docker
.
For further information please also have a look at the documentation.
回答2:
In docker
1.8+
the service file settings changed a little:
[Service]
EnvironmentFile=-/etc/default/docker
# in docker 1.7 use ExecStart:
ExecStart=/usr/bin/docker -d $DOCKER_OPTS -H fd://
# in docker 1.8 use ExecStart:
ExecStart=/usr/bin/docker daemon $DOCKER_OPTS -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
& some other notes for Debian / Fedora with the latest docker & a custom directory.
来源:https://stackoverflow.com/questions/31817065/cannot-change-docker-image-directory