Moving docker files to a different partition or physical drive can be advantageous in certain senarios.
sudo systemctl stop docker.service
sudo systemctl stop docker.socket
Here we will edit the docker service and add the -g
to specify the new location.
sudo -e /lib/systemd/system/docker.service
Change the line begining with ExecStart
to use the new location. Your line may contain other flags that you probably should still include.
ExecStart=/usr/bin/dockerd -g /new_path/docker -H fd:// [any other flags there may be]
sudo mkdir -p /new_path/docker
sudo rsync -aqxP /var/lib/docker/ /new_path/docker
sudo systemctl daemon-reload
sudo systemctl start docker
Docker should now spin up. I needed to restart all the containers I had running regardless of their restart policy.