1. 导出:docker image save <image_name:tag> -o xxx.image
    • -o:output 即导出
    1. 导入:docker image load -i xxx.image
    • -i:input 即导入
    1. [root@localhost ~]# docker image ls
    2. REPOSITORY TAG IMAGE ID CREATED SIZE
    3. quay.io/bitnami/nginx latest 94b72494607b 9 hours ago 90.5MB
    4. busybox latest 69593048aa3a 5 months ago 1.24MB
    5. localhost:5002/busybox v1.0 69593048aa3a 5 months ago 1.24MB
    6. nginx 1.20.0 7ab27dbbfbdf 6 months ago 133MB
    7. [root@localhost ~]#
    8. [root@localhost ~]# docker image save nginx:1.20.0 -o nginx.image
    9. [root@localhost ~]#
    10. [root@localhost ~]# ls
    11. agent.jar Desktop Documents initial-setup-ks.cfg Music nginx.image Public test_db-master Videos
    12. anaconda-ks.cfg D:\JenkinsNode Downloads jenkins mysql Pictures Templates test.txt
    13. [root@localhost ~]#
    14. [root@localhost ~]# docker image rm 7ab
    15. Untagged: nginx:1.20.0
    16. Untagged: nginx@sha256:ea4560b87ff03479670d15df426f7d02e30cb6340dcd3004cdfc048d6a1d54b4
    17. Deleted: sha256:7ab27dbbfbdf4031f0603a4b597cc43031ff883b54f9329f0309c80952dda6f5
    18. Deleted: sha256:5b2a9404d052ae4205f6139190fd4b0921ddeff17bf2aaf4ee97f79e1a8242fe
    19. Deleted: sha256:03ebf76f0cbf5fd32ca010bb589c2139ce7e44c050fe3de2d77addf4cfd25866
    20. Deleted: sha256:0191669d087dce47072254a93fe55cbedd687f27d3798e2260f846e8f8f5729a
    21. Deleted: sha256:17651c6a0ba04d31da14ac6a86d8fb3f600883f9e155558e8aad0b94aa6540a2
    22. Deleted: sha256:5a673ff4c07a1b606f2ad1fc53697c99c45b0675734ca945e3bb2bd80f43feb8
    23. Deleted: sha256:02c055ef67f5904019f43a41ea5f099996d8e7633749b6e606c400526b2c4b33
    24. [root@localhost ~]#
    25. [root@localhost ~]# docker image load -i nginx.image
    26. 02c055ef67f5: Loading layer [==================================================>] 72.53MB/72.53MB
    27. 1839f9962bd8: Loading layer [==================================================>] 64.8MB/64.8MB
    28. a2f4f809e04e: Loading layer [==================================================>] 3.072kB/3.072kB
    29. 9b63e6289fbe: Loading layer [==================================================>] 4.096kB/4.096kB
    30. f7141923aaa3: Loading layer [==================================================>] 3.584kB/3.584kB
    31. 272bc57d3405: Loading layer [==================================================>] 7.168kB/7.168kB
    32. Loaded image: nginx:1.20.0
    33. [root@localhost ~]#
    34. [root@localhost ~]# docker image ls
    35. REPOSITORY TAG IMAGE ID CREATED SIZE
    36. quay.io/bitnami/nginx latest 94b72494607b 9 hours ago 90.5MB
    37. busybox latest 69593048aa3a 5 months ago 1.24MB
    38. localhost:5002/busybox v1.0 69593048aa3a 5 months ago 1.24MB
    39. nginx 1.20.0 7ab27dbbfbdf 6 months ago 133MB