Method 1. Saving and Loading the Image from TAR files:

Docker permit us to save images into tar files using the Docker save command. TAR files compress the image and share them quickly and easily. The below code save the image as TAR files.

$ docker save -o <tar file path in source host machine> <image name>


Then we copy the tar files using cp, rsync, scp tools. Next, We restore the image from this tar file using Docker load command.

$ docker load -i <path to image tar file>



Method 2. Copy Docker Images Via SSH

We can also transfer our Docker images through SSH and bzip the content to compress it while transfer. The below command used to do this -


$ docker save <image> | bzip2 | \
ssh user@host 'bunzip2 | docker load'