How To Change Docker Data Folder Configuration

İbrahim Gündüz
Developer Space
Published in
2 min readMay 2, 2018

--

From the beginning I would like to say, this not a copy/paste article :)

I would like to mention about it first, because of today I faced the same situation and found too many posts which are copy/pasted and useless :)

Let’s start with WHAT YOU SHOULD NOT DO first:

  • Stop docker service by the following command:
# service docker stop
  • Open the /etc/default/docker file, uncomment the following line and add the new path to DOCKER_OPTS variable like ‘-g /mnt/docker’
  • Start the docker service again by the following command.
# service docker start

And most probably you will see it won’t work, even you rebooted the machine. :)

So you will try the second way which is not clean… Making symlink from the new directory to /var/lib/docker. And you’ll say ‘Thank you it works for me!’

Basically, the issue caused by the initial systemd script, comes with installation. Docker is not aware of your changes because the script doesn’t pass the DOCKER_OPTS variable to the daemon while starting the service.

How To Solve The Issue?

There are two ways :

  • You can add the…

--

--