Change docker root path in centos, oracle linux

I am having docker version installed:

Docker version 18.03.1-ce, build 9ee9f40.

OS: centos 7

I want to change default docker root to /var/some_path.

I found

  1. Check the new mount path is of xfs( with ftype=1 ) or ext4 partition. for checking xfd: xfs_info Its because docker files work only on either of the two partitions. If your new mount type is above mentioned, then follow step 2.
  2. Stop the docker sudo systemctl stop docker
  3. Create a file in location /etc/docker with name daemon.json.
nano /etc/docker/daemon.json

give the below infos in the file:

    "data-root": "/mnt/customlocation/docker-data",
    "storage-driver": "overlay2"
  1. Start the docker
sudo systemctl stop docker
  1. Verification. Type command:
docker info

check for the docker root directory

Leave a Reply