By Bobby Iliev
In some cases, you might not want to push a Docker image over to Docker Hub or a private Docker repository.
Here is how you could transfer a Docker image from one server to another without pushing the image to an external Docker repository!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
In order to transfer a Docker image from one server to another, what you need to do is first export the image to a file, then copy that file over from your current server to the new one using scp
or rsync
and finally load the image to your new server. Here’s how to do that:
- sudo docker save -o /home/sammy/your_image.tar your_image_name
tar
file of your image and store it at the /home/sammy/your_image.tar
folder. You can check the size of the file with the ls
command:- ls -lah /home/sammy/your_image.tar
rsync
, scp
, or SFTP using Filezilla for example. My personal favorite is rsync
. If you are not familiar with rsync
, I strongly suggest going through this tutorial here on how to use rsync
:In case that you decide to use rsync
as well, to copy the file over run the following command:
rsync -avz /home/sammy/your_image.tar username@remote_server_ip_address:destination_directory
Note: make sure to chagne the
destination_directory
, theusername
and theremote_server_ip_address
with your actual details
.tar
file copied over to your new server, SSH to the new server and load the Docker image:- sudo docker load -i your_image.tar
docker images
to see the list of the available images:- sudo docker images
Here is a quick video demo on how to do the above as well:
This is pretty much it! I hope that it helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.