How do I transfer a Docker image from one machine to another one without using a repository, no matter private or public?
I create my own image in VirtualBox, and when it is finished I try to deploy to other machines to have real usage.
Since it is based on my own based image (like Red Hat Linux), it cannot be recreated from a Dockerfile. My dockerfile isn't easily portable.
Are there simple commands I can use? Or another solution?
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.
You can also use the DOCKER_HOST variable to copy images from one host to another. You will need the SSH credentials and both the users on the local and remote machines should be in the Docker group.
2. Container image migration. The most commonly used method to move Docker container to another host, is by migrating the image linked to that container. For the container that has to be moved, first its Docker image is saved into a compressed file using 'docker commit' command.
You will need to save the Docker image as a tar file:
docker save -o <path for generated tar file> <image name>
Then copy your image to a new system with regular file transfer tools such as cp
, scp
or rsync
(preferred for big files). After that you will have to load the image into Docker:
docker load -i <path to image tar file>
PS: You may need to sudo
all commands.
EDIT: You should add filename (not just directory) with -o, for example:
docker save -o c:/myfile.tar centos:16
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