We have noticed that our containers are taking up a lot of space, one of the reasons for this is the images.
We would like to move the images.
I know right now they are stored in /var/lib/docker/graph/<id>/layer
Is there a way to move these to another location/persistent disk?
To export your image to a tar file, run the docker save command, specifying a name for the . tar file, and the docker image name. This will save the docker image locally.
Volumes are the best way to persist data in Docker. Bind mounts may be stored anywhere on the host system. They may even be important system files or directories. Non-Docker processes on the Docker host or a Docker container can modify them at any time.
To move images to another drive or another server:
docker save image_name > image_name.tar mv image_name.tar /somewhere/else/
Load it back into docker
docker load < image_name.tar
Reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With