docker 镜像导入导出的方法

前言

导入、导出镜像

导出镜像

  1. 查看镜像
shell> docker images
REPOSITORY                                      TAG                IMAGE ID       CREATED         SIZE
nacos/nacos-server                              v2.2.1             faff56ad2ef5   16 months ago   1.17GB
docker.elastic.co/elasticsearch/elasticsearch   7.10.0             37190fe5beea   3 years ago     774MB
  1. 导出镜像
shell> docker save faff56ad2ef5 > docker_images_nacos_v2.2.1.tar

或者

shell> docker save -o docker_images_nacos_v2.2.1.tar nacos/nacos-server:v2.2.1

导入镜像

  1. 导入镜像
shell>docker load < docker_images_nacos_v2.2.1.tar
  1. 查看镜像
shell> docker images
REPOSITORY      TAG       IMAGE ID       CREATED         SIZE
                          faff56ad2ef5   16 months ago   1.17GB
  1. 重命名镜像
shell> docker tag faff56ad2ef5 nacos:v2.2.1
  1. 再次查看镜像
shell> docker images
REPOSITORY      TAG       IMAGE ID       CREATED         SIZE
nacos           v2.2.1    faff56ad2ef5   16 months ago   1.17GB

从容器导出,导入镜像

从容器导出

  1. 查看容器
shell> docker ps -a
CONTAINER ID   IMAGE          COMMAND        CREATED         STATUS                     PORTS        NAME
3530f4b0b8ed   hello-world    "/hello"       11 months ago   Exited (0) 11 months ago                strange_noether                                                       
  1. 从容器导出
shell> docker export 3530f4b0b8ed > docker_container_hello-world.tar

导入镜像

  1. 导入镜像
shell> docker import - new-hello-world < docker_container_hello-world.tar
  1. 查看镜像
shell> docker images
REPOSITORY                                      TAG                IMAGE ID       CREATED          SIZE
new-hello-world                                 latest             e8705c3d6974   15 seconds ago   13.3kB

相关推荐

  1. docker 镜像导入导出方法

    2024-07-15 01:28:02       19 阅读
  2. docker导出导入镜像或容器

    2024-07-15 01:28:02       43 阅读
  3. dockerdesktop 导出镜像导入镜像

    2024-07-15 01:28:02       50 阅读
  4. linux系统中docker镜像创建、导入导出和执行

    2024-07-15 01:28:02       36 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-15 01:28:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-15 01:28:02       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-15 01:28:02       58 阅读
  4. Python语言-面向对象

    2024-07-15 01:28:02       69 阅读

热门阅读

  1. Node.js 安装配置

    2024-07-15 01:28:02       21 阅读
  2. apache Kylin系列介绍及配置

    2024-07-15 01:28:02       16 阅读
  3. Hudi 索引总结 - Parquet布隆过滤器写入过程

    2024-07-15 01:28:02       21 阅读
  4. Spring源码(四) Aware 接口

    2024-07-15 01:28:02       21 阅读
  5. 12、如何用事件风暴构建领域模型

    2024-07-15 01:28:02       20 阅读
  6. 免杀中用到的工具

    2024-07-15 01:28:02       18 阅读
  7. 【FPGA】Verilog 中 typedef enum 用法教程

    2024-07-15 01:28:02       17 阅读
  8. React@16.x(58)Redux@4.x(7)- 实现 combineReducers

    2024-07-15 01:28:02       21 阅读
  9. springsecurity01

    2024-07-15 01:28:02       15 阅读