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

相关推荐
可涵不会debug2 小时前
超级马里奥常驻极空间以后怎么打开?Docker运行游戏页面,手机电脑都能从浏览器进入
游戏·docker·智能手机
姜鱼问生20 小时前
网页一片白?Docker 跑 Nginx 读不到文件,403 Forbidden 排查实录
nginx·docker·容器
ms72wx21 小时前
Docker 命令学习笔记:从入门到进阶的实战指南
笔记·学习·docker
java_logo21 小时前
Docker 部署 Excalidraw:轻松搭建手绘风格白板
运维·docker·容器·excalidraw·白板·轩辕镜像
海的透彻1 天前
如何让docker容器启动时用自定义的用户
java·docker·dubbo
程序员清风1 天前
LibreChat 实战:用 Docker 搭建可扩展的多模型对话平台
运维·docker·容器
Web3&Basketball1 天前
从0到1落地AI Agent沙箱隔离Docker实战:踩坑全记录
运维·docker·容器·agent·容器安全·沙箱隔离
bluebonnet271 天前
【docker】使用regctl免安装docker下载镜像
运维·docker·容器
Java开发追求者2 天前
windows快速安装docker
windows·docker·安装·1024程序员节
骑着蜗牛撵大象3272 天前
飞牛fnOS部署Damselfly:Compose编排、照片目录与7100固定访问
java·docker·rpc·dubbo·fnos·照片管理·damselfly