How to move docker data direcory to a different location in ubuntu.
The default data directory used by docker system for storing images is /var/lib/docker
. You may want to move this directory to another location on your system.
This goal can be achieved by following the next steps:
sudo service docker stop`
{
"graph": "/path/to/your/docker"
}
sudo rsync -aP /var/lib/docker/ /path/to/your/docker
sudo mv /var/lib/docker /var/lib/docker.old
sudo service docker start
Create a new doocker and check that a new image appears in /path/to/your/docker
When you are sure that the new directory is being used correctly by docker daemon you can delete the old data directory.
sudo rm /var/lib/docker
Please check (Destrero 2020) for more detailed tutorial on this topic
Destrero, Augusto. 2020. “How to Move Docker Data Directory to Another Location on Ubuntu.” https://www.guguweb.com/2019/02/07/how-to-move-docker-data-directory-to-another-location-on-ubuntu/.
If you see mistakes or want to suggest changes, please create an issue on the source repository.
For attribution, please cite this work as
Spano (2020, Sept. 20). andreaspano blog: Docker data direcory. Retrieved from https://andreaspano.github.io/posts/2020-09-20-how-to-move-docker-data-direcory/
BibTeX citation
@misc{spano2020docker, author = {Spano, Andrea}, title = {andreaspano blog: Docker data direcory}, url = {https://andreaspano.github.io/posts/2020-09-20-how-to-move-docker-data-direcory/}, year = {2020} }