We can use "docker save" and "docker load" commands to achieve this, combined with ssh.
These are the steps:
Save your image to a file
$ docker save -o filename imagename:tag
To get a smaller filesize, we can use xz, bzip2 or gz compression
$ docker save imagename:tag | xz > filename.xz
$ docker save imagename:tag | bzip2 > filename.bz2
$ docker save imagename:tag | gzip > filename.gz
Then, transfer the file over ssh to another machine
$ scp filename.xz user@anothermachine
Load back the image in the other machine. "Docker load" will automatically decompress the file if it is compressed with xz, bzip2 or gz.
$ docker load -i filename.xz
We can also use redirection, instead of the -i option
$ docker load < filename.xz
All that can also be done in one liner
$ docker save imagename:tag | xz | ssh user@anothermachine docker load
No comments:
Post a Comment