0. [optional] prune unused Docker Objects
To remove unused images, docker image prune -a
, and containers , docker container prune
sudo service docker stop
then make sure docker is stop with ps aux| grep docker
sudo cp -r /var/lib/docker /your/storage/dir
3. Update Docker Configs per this post
Ubuntu/Debian: edit your /etc/default/docker file with the -g option: DOCKER_OPTS="-dns 8.8.8.8 -dns 8.8.4.4 -g /mnt"
Fedora/Centos: edit /etc/sysconfig/docker, and add the -g option in the other_args variable: ex. other_args="-g /your/storage/dir". If there’s more than one option, make sure you enclose them in " ". After a restart, (service docker restart) Docker should use the new directory.
sudo service docker restart