Changing docker storage location
Changing the default storage location for Docker
Docker comes with a default location for storing artefacts locally (e.g.
/var/lib/docker on linux) like containers and images. It can be convenient to store these in alternative places, like an attached storage volume. The following steps can be performed to change the default location;
sudo mkdir /the_new_directory/to_store/docker_artefacts/
sudo systemctl stop docker
sudo mount --rbind /the_new_directory/to_store/docker_artefacts /var/lib/docker
sudo systemctl start docker
/the_new_directory/to_store/docker_artefacts/ should be replaced with the new location. Note that the defualt docker location may be different to what is shown above and should be determined from the operating system that docker is running on.