dockerミラーコンテナインポートエクスポート
記録して、節約してから自分でいつも忘れます.
ubuntu-14.04-x86_64.tar.gzはダウンロードしたテンプレートファイルであり、インポートテンプレートファイルの例は以下の通りである.
ミラーをubuntu_にエクスポートhaha.tar
ミラーインポート、ubuntu_haha.tarミラーインポート名ubuntu_haha:v1
インポート後のミラーの表示
注意:ミラーインポートでは、コマンドを使用することもできます.
コンテナエクスポート、bff 3 c 385 e 273コンテナのID、エクスポート後のコンテナのファイル名ubuntu_x1.tar
新しいミラー名を生成:ubuntu-zxl,1 cb 05 fbe 012 eコンテナID
新しいミラーの生成を表示
コンテナをミラーにインポート
ubuntu-14.04-x86_64.tar.gzはダウンロードしたテンプレートファイルであり、インポートテンプレートファイルの例は以下の通りである.
root@zxl-node4:~# ll ubuntu-14.04-x86_64.tar.gz
-rw-r--r-- 1 root root 154056446 May 17 10:04 ubuntu-14.04-x86_64.tar.gz
root@zxl-node4:~# cat ubuntu-14.04-x86_64.tar.gz | docker import - ubuntu_template:v1
b4ebc953c6f45c7be7d12bc226ad4fe445c97a9589bb714c31d205a7a9fcc686
root@zxl-node4:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu_template v1 b4ebc953c6f4 43 seconds ago 415.7 MB
ミラーをubuntu_にエクスポートhaha.tar
root@zxl-node4:~# docker save -o ubuntu_haha.tar ubuntu:latest
root@zxl-node4:~# ll ubuntu_haha.tar
-rw-r--r-- 1 root root 197043712 May 17 10:03 ubuntu_haha.tar
ミラーインポート、ubuntu_haha.tarミラーインポート名ubuntu_haha:v1
root@zxl-node4:~# cat ubuntu_haha.tar | docker import - ubuntu_haha:v1
8955fbb15571dd4621f270363238d8859fc6a5e2ee797b8267e86abdbc50f9f7
インポート後のミラーの表示
root@zxl-node4:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu_haha v1 8955fbb15571 22 seconds ago 197 MB
注意:ミラーインポートでは、コマンドを使用することもできます.
docker load < ubuntu_haha.tar
docker load --input ubuntu_haha.tar
コンテナエクスポート、bff 3 c 385 e 273コンテナのID、エクスポート後のコンテナのファイル名ubuntu_x1.tar
docker export bff3c385e273 > ubuntu_x1.tar
新しいミラー名を生成:ubuntu-zxl,1 cb 05 fbe 012 eコンテナID
[root@localhost ~]# docker commit -m "Add a new directory" -a "zxl" 1cb05fbe012e ubuntu-zxl
379f06b28c5e29bea0aa4e8ea0749b0f8583e663d3260d94ceb0f469724f17ab
新しいミラーの生成を表示
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ubuntu-zxl latest 379f06b28c5e 3 minutes ago 188.3 MB
コンテナをミラーにインポート
cat ubuntu_x1.tar | docker import - ubuntu_x1:v1