3
votes

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?

2

2 Answers

7
votes

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.

6
votes

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.