Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I move a docker container's image to a persistent disk?

Tags:

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?

like image 262
dvaini Avatar asked Jan 31 '14 17:01

dvaini


People also ask

How do I save a docker image to a local directory?

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.

How do I persist docker data?

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.


1 Answers

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.

like image 63
Ken A. Avatar answered Oct 31 '22 19:10

Ken A.