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

  2. 导出镜像

    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

  2. 查看镜像

    shell> docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    faff56ad2ef5 16 months ago 1.17GB

  3. 重命名镜像

    shell> docker tag faff56ad2ef5 nacos:v2.2.1

  4. 再次查看镜像

    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

  2. 从容器导出

    shell> docker export 3530f4b0b8ed > docker_container_hello-world.tar

导入镜像

  1. 导入镜像

    shell> docker import - new-hello-world < docker_container_hello-world.tar

  2. 查看镜像

    shell> docker images
    REPOSITORY TAG IMAGE ID CREATED SIZE
    new-hello-world latest e8705c3d6974 15 seconds ago 13.3kB

相关推荐
biubiubiu07062 小时前
Docker 快速通关
docker·容器·eureka
两点王爷3 小时前
docker 创建和使用存储卷相关内容
java·docker·容器
知秋贺6 小时前
如何在ubuntu24中,使用docker 运行ros2 humble版本
运维·docker·容器
yanwumuxi6 小时前
Windows本地部署Dify(Docker)
人工智能·docker·语言模型
浪潮IT馆7 小时前
WSL2 + Docker Desktop 部署 Dify
运维·docker·容器
芥子沫8 小时前
可独立部署的健身饮食管理推荐:wger,Docker一键安装部署教程
docker·容器·开源·健身
robin59118 小时前
【技术】更改docker网络MTU办法
网络·docker·容器
恼书:-(空寄10 小时前
Docker Swarm + K8s 集群部署完整指南
docker·容器·kubernetes
石像鬼₧魂石10 小时前
ARL(资产灯塔)从 Docker 安装到部署启动 完整详细流程(复习专用)
运维·docker·容器
小江的记录本10 小时前
【Docker】Docker系统性知识体系与命令大全(镜像、容器、数据卷、网络、仓库)
java·网络·spring boot·spring·docker·容器·eureka