We currently have a ‘Docker Image’ running on a Droplet (MUCH to big)… we need to migrate this to some other Droplet. What is the process for moving a Docker image from one Droplet to another? thank you
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
There are a few ways to do that:
This would essentially mean that you would compress the data to a file from the container’s file system. The data would be saved as a ‘gzip’ file. To do that run:
Then copy this file to the droplet and start the container with:
After that start the container on the new host with the
docker run
command.This is the most commonly used method. You would need to first create a docker image of the running container with the
docker commit
command:Then you can push your image to docker hub:
After that push your new image to docker hub. For that you would need a docker hub account first:
Login:
Push the image:
Then on your new droplet, login to docker hub again:
And pull your image:
The images can be compressed using
docker save
and moved to a new host.This would create a tarball of your local docker image which you could copy to your new server and re-deploy with the
docker load
command:If all went through successfully you should be able to see your new image with:
Hope that this helps! Regards, Bobby