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
- 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.
- Stop the docker sudo systemctl stop docker
- 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"
}
- Start the docker
sudo systemctl stop docker
- Verification. Type command:
docker info
check for the docker root directory