作成した Docker Image は、そのコンピュータの中にある。 Docker Image をファイル化すると、Image を取り出して、他のコンピュータに持っていくことができる。
$ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu24-sshd-user latest 081475092073 21 hours ago 334MB ubuntu24-apache2-php-sshd-uid latest 060019acdfc1 5 days ago 470MB ubuntu24-apache2-php-sshd latest 52d211a7a4f8 6 days ago 470MB ubuntu24-apache2-sshd latest 2e70eec62db8 6 days ago 431MB
$ docker save -o saved_image.tar ubuntu24-sshd-user
$ ls -l saved_image.tar -rw------- 1 nitta nitta 81128960 5月 3 13:01 saved_image.tar
nitta@um580:~$ tar tvf saved_image.tar drwxr-xr-x 0/0 0 1970-01-01 09:00 blobs/ drwxr-xr-x 0/0 0 1970-01-01 09:00 blobs/sha256/ -r--r--r-- 0/0 856 1970-01-01 09:00 blobs/sha256/0814750920733f079b848d1aba8a59048d78437b3517c9ec1ec30e7bea1f4351 -r--r--r-- 0/0 29717652 1970-01-01 09:00 blobs/sha256/2726e237d1a374379e783053d93d0345c8a3bf3c57b5d35b099de1ad777486ee -r--r--r-- 0/0 1005 1970-01-01 09:00 blobs/sha256/2af6a6264e7611cc754bfc3fa12b97c3f33d28d2ff55866da50bbe6e3fcdf2c6 -r--r--r-- 0/0 632 1970-01-01 09:00 blobs/sha256/30f05e335003f800490c5046292274c668ce6e5985489005fc9b1fdc2c6fead0 -r--r--r-- 0/0 632 1970-01-01 09:00 blobs/sha256/32eb8f217b03c29bda5e9e4fba67dd3e5e6a4fb5ac870324e15bf1ec34cd25e1 -r--r--r-- 0/0 51383512 1970-01-01 09:00 blobs/sha256/4ed5ec6e2d665c54d19a3d6bea79af0811c3be1ae1d1cf690eea5e9bd5f369ac -r--r--r-- 0/0 32 1970-01-01 09:00 blobs/sha256/4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 -r--r--r-- 0/0 3926 1970-01-01 09:00 blobs/sha256/54757c05dcd7827862cf8051a7255d980dc4129ccf973123e8e48519a7adfc41 -r--r--r-- 0/0 566 1970-01-01 09:00 blobs/sha256/7e26c65713bfa0e08c82f9007ba8b49807fc9d740bd290969993fb0266b1c2cb -r--r--r-- 0/0 167 1970-01-01 09:00 blobs/sha256/85d03e6e230ca53716daa5fd29be71078a5790e2bc428297bd67aa0b7fe36067 -r--r--r-- 0/0 304 1970-01-01 09:00 blobs/sha256/8a3888df28e649397e4222c452827549ae90d930947025e3181f605d8f8f3d55 -r--r--r-- 0/0 1615 1970-01-01 09:00 blobs/sha256/ac04241b04b3f29b47e9f1f6d8f8519ef01f58030be827eab71fccb29f8b9ac7 -r--r--r-- 0/0 1633 1970-01-01 09:00 blobs/sha256/d09b81af76091dd91cefcc88ec8cf9a77675ba11e7b99bd7d81b84b59ae0f1b7 -rw-r--r-- 0/0 371 1970-01-01 09:00 index.json -rw-r--r-- 0/0 704 1970-01-01 09:00 manifest.json -r--r--r-- 0/0 30 1970-01-01 09:00 oci-layout
Image を保存したファイルを他のPC上にコピーした
$ ls -l saved_image.tar -rw------- 1 nitta なし 81128960 5月 3 13:20 saved_image.tar
$ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE nitta/tensorflow 20-08-ssh 887418c386bb 4 months ago 11.7GB nvcr.io/nvidia/tensorflow 23.08-tf2-py3 fcda27c68c2c 21 months ago 14.2GB nvcr.io/nvidia/tensorflow 23.03-tf1-py3 a23820905389 2 years ago 16.3GB nvcr.io/nvidia/tensorflow 21.08-tf2-py3 2abe022b55d1 3 years ago 11.5GB nvcr.io/nvidia/pytorch 20.10-py3 896906697db3 4 years ago 12.9GB nvcr.io/nvidia/tensorflow 20.08-tf2-py3 fc78ab8df49c 4 years ago 11GB nvcr.io/nvidia/tensorflow 19.07-py3 a9c6af3f3056 5 years ago 6.71GB
$ docker load -i saved_image.tar 3abdd8a5e7a8: Loading layer [==================================================>] 29.72MB/29.72MB 40c13f3d22a9: Loading layer [==================================================>] 51.38MB/51.38MB 68298690a060: Loading layer [==================================================>] 1.633kB/1.633kB 5f70bf18a086: Loading layer [==================================================>] 32B/32B 8ea444686848: Loading layer [==================================================>] 304B/304B e996ad04e1ca: Loading layer [==================================================>] 632B/632B f973a624ed16: Loading layer [==================================================>] 632B/632B Loaded image: ubuntu24-sshd-user:latest
$ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu24-sshd-user latest 54757c05dcd7 21 hours ago 222MB nitta/tensorflow 20-08-ssh 887418c386bb 4 months ago 11.7GB nvcr.io/nvidia/tensorflow 23.08-tf2-py3 fcda27c68c2c 21 months ago 14.2GB nvcr.io/nvidia/tensorflow 23.03-tf1-py3 a23820905389 2 years ago 16.3GB nvcr.io/nvidia/tensorflow 21.08-tf2-py3 2abe022b55d1 3 years ago 11.5GB nvcr.io/nvidia/pytorch 20.10-py3 896906697db3 4 years ago 12.9GB nvcr.io/nvidia/tensorflow 20.08-tf2-py3 fc78ab8df49c 4 years ago 11GB nvcr.io/nvidia/tensorflow 19.07-py3 a9c6af3f3056 5 years ago 6.71GB