免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年6月1日 星期一

how to transfer a docker image from one computer to another


http://stackoverflow.com/questions/23935141/how-to-copy-docker-images-from-one-host-to-another-without-via-repository
http://it.3hd.me/2015/03/docker-exportimport-pullcommit-saveload.html


//=== save/load

0. save the docker image as a tar file on pc1

$ docker save -o savefname.tar imgname
or
$ docker save imgname > savefname.tar


1. scp savefname.tar to pc2
[to save bandwidth, compress-> send-> decompress is recommended]

2. load savefname.tar to image on pc2
$ docker load < savefname.tar
or
$ docker load -i savefname.tar


3. verify 'imgname' is restored on pc2
$ docker images -a imgname



//=== export/import
[operating on container(running or not), the resultant img will lose previous history and layers]

0. on pc1:
$ docker export container1 > c1.tar

1. copy c1.tar from pc1 to pc2

2. on pc2:
$ cat c1.tar | docker import - new_imgname:tagname




//=== http://unix.stackexchange.com/questions/70581/scp-and-compress-at-the-same-time-no-intermediate-save
[Q] does scp compress file implicitly ???

"""...
scp itself can compress the data

-C Compression enable. ...

$ scp -C source user@server:/path/to/backup


...
7z should not be used for backups on Linux. As stated on the 7z man page:

DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
- 7-zip does not store the owner/group of the file.


..."""


$ tar zcvf - MyBackups | ssh user@server "cat > /path/to/backup/foo.tgz"



沒有留言:

張貼留言