How do I change the Docker image installation directory?

data-root was the ideal solution for me on 18.04.
I followed your tip and finally found a great workflow/procedure to follow for my migration Change Docker Data Directory on Debian - check out the disqus comment as well, as I had a little issue, that was due to my specific installation of - the first startup of my “moved” containers did not succeed, but stopping and starting then brought them back to life.

1 Like

Yes “data-root” is the ideal solution for RHEL 7.x and Docker-EE environment as well who are using Docker engine version 17.05 or above as because “graph” option is now deprecated from engine version 17.05.
For more details please follow the below links about it. and
For me, below change in “/etc/docker/daemon.json” file perfectly worked.
“data-root”: “/new/path/to/docker-data”

thank you very much! helped me a lot!

I tried to move docker directory, but I am having this error while trying to run any container in my computer:

/bin/bash: error while loading shared libraries: cannot change memory protections

I have a machine running Fedora 30 with two drivers. My first drive is a SSD mounted at / . The second drive is a standard HDD, mounted at /home . Originally, the base docker base directory was the default /lib/var/docker . Everything worked normally, but since my SSD is small, I tried to move the base directory to /home/docker-files .
This is the content of my daemon.json file:

    "graph": "/home/docker-files"

If I erase the graph and restart docker process, everything works fine again. The problem only happens when I set to the secondary drive.
I made some searches, but was not able to find similar situations. Does anybody knows what is going on?
I am open to different approaches to move the base directory to the secondary drive.