导出镜像

docker save -o xxx.tar image1 image2 ….imagen
解压tar包之后,有下面一些文件

manifest

type manifestItem struct {Config       stringRepoTags     []stringLayers       []stringParent       image.ID                                 `json:",omitempty"`LayerSources map[layer.DiffID]distribution.Descriptor `json:",omitempty"`
}

config是镜像的config文件
RepoTags一般都是null
Layres是各个层的目录

config文件的格式

// V1Image stores the V1 image configuration.
type V1Image struct {// ID is a unique 64 character identifier of the imageID string `json:"id,omitempty"`// Parent is the ID of the parent imageParent string `json:"parent,omitempty"`// Comment is the commit message that was set when committing the imageComment string `json:"comment,omitempty"`// Created is the timestamp at which the image was createdCreated time.Time `json:"created"`// Container is the id of the container used to commitContainer string `json:"container,omitempty"`// ContainerConfig is the configuration of the container that is committed into the imageContainerConfig container.Config `json:"container_config,omitempty"`// DockerVersion specifies the version of Docker that was used to build the imageDockerVersion string `json:"docker_version,omitempty"`// Author is the name of the author that was specified when committing the imageAuthor string `json:"author,omitempty"`// Config is the configuration of the container received from the clientConfig *container.Config `json:"config,omitempty"`// Architecture is the hardware that the image is built and runs onArchitecture string `json:"architecture,omitempty"`// OS is the operating system used to build and run the imageOS string `json:"os,omitempty"`// Size is the total size of the image including all layers it is composed ofSize int64 `json:",omitempty"`
}// Image stores the image configuration
type Image struct {V1ImageParent     ID        `json:"parent,omitempty"`RootFS     *RootFS   `json:"rootfs,omitempty"`History    []History `json:"history,omitempty"`OSVersion  string    `json:"os.version,omitempty"`OSFeatures []string  `json:"os.features,omitempty"`// rawJSON caches the immutable JSON associated with this image.rawJSON []byte// computedID is the ID computed from the hash of the image config.// Not to be confused with the legacy V1 ID in V1Image.computedID ID
}

Layer层json文件格式

layer层中有json和VERSION两个文件
json文件的格式就是V1Image

docker save流程

Save(names []string, outStream io.Writer)
func (s *saveSession) save(outStream io.Writer) error   {for id, imageDescr := range s.images {foreignSrcs, err := s.saveImage(id)}...生成manifest文件fs, err := archive.Tar(tempDir, archive.Uncompressed)
}
func (s *saveSession) saveImage(id image.ID) (map[layer.DiffID]distribution.Descriptor, error) {for i := range img.RootFS.DiffIDs {        v1ID, err := v1.CreateID(v1Img, rootFS.ChainID(), parent)v1Img.ID = v1ID.Hex()       src, err := s.saveLayer(rootFS.ChainID(), v1Img, img.Created)}configFile := filepath.Join(s.outDir, id.Digest().Hex()+".json")if err := ioutil.WriteFile(configFile, img.RawJSON(), 0644); err != nil {return nil, err}
}
func (s *saveSession) saveLayer(id layer.ChainID, legacyImg image.V1Image, createdTime time.Time) (distribution.Descriptor, error) {

首先save列表参数中所有的image,然后生成manifest文件
每个image保存的过程是:
保存每一个层,每个层中有一个v1Img结构
生成config json文件

docker镜像格式相关推荐

  1. Docker 入门系列(2)- Docker 镜像, 免 sudo 使用 docker 命令、获取查看、修改镜像标签、查找删除创建镜像、导入导出镜像

    1. 免 sudo 使用 docker 命令 如果还没有 docker group 就添加一个 sudo groupadd docker 将用户加入该 group 内 sudo gpasswd -a ...

  2. Docker学习(三)-----Docker镜像常用命令

    六.Docker镜像 镜像是Docker的三大组件之一 Docker运行容器前需要本地存在对应的镜像,如果本地不存,Docker会从镜像仓库下载 6.1Docker获取镜像 6.1.1查找镜像 我们可 ...

  3. Docker镜像优化

    Docker镜像优化 原文:Docker镜像优化 前言 上篇博文说到使用Visual Studio Tools for Docker帮助我们生成Dockerfile,现在我们讨论下生成的Dockerf ...

  4. 通过Dockerfile构建Docker镜像

    Dockerfile是一个文本文件,其内包含了一条条的指令(Instruction),每一条指令构建一层,因此每一条指令的内容,就是描述该层应当如何构建. Dockerfile支持Shell类的行尾添 ...

  5. 使用Maven插件构建SpringBoot项目,生成Docker镜像push到DockerHub上

    一个用于构建和推送Docker镜像的Maven插件. 使用Maven插件构建Docker镜像,将Docker镜像push到DockerHub上,或者私有仓库,上一篇文章是手写Dockerfile,这篇 ...

  6. Docker镜像、容器数据卷和Dockerfile

    Docker镜像 概述 镜像是一种轻量级.可执行的独立软件包,用来打包软件运行环境和基于运行环境开发的软件,它包含运行某个软件所需的所有内容,包括代码.运行时.库.环境变量和配置文件. UnionFS ...

  7. CVPR 2021 | 记录SCRFD人脸检测C++工程化(含docker镜像)

    作者 | DefTruth@知乎(已授权) 来源 | https://zhuanlan.zhihu.com/p/455165568 编辑 | 极市平台 导读 前段时间写了篇关于SCRFD(吊打了自己的 ...

  8. docker 镜像修改的配置文件自动还原_原创 | 全网最实在的docker入门教程四

    作者:潘吉祥 上一篇我们学习了如何使用Dockerfile制作自己的镜像,不过这种方式更像纯粹的运维方式,作为开发者来说,未免有些小繁琐,一个不小心写错些命令就执行失败,我们还不知道错误在哪,这着实有 ...

  9. Docker镜像制作规范

    Docker镜像制作规范 镜像(Image)是在基础文件集(root filesystem)之上依次变更的集合,及在容器运行的默认执行参数. 术语 层(layer) 镜像由层(layer)组成.每一层 ...

最新文章

  1. Java 刷题必须了解的 API
  2. Morris post order traversal algorithm
  3. 九种东西吃多会...
  4. 课程设计+计算机程序设计,高职计算机程序设计课翻转课堂初探
  5. pip安装python模块遇到一直出现retrying的问题
  6. angular2--pipe管道使用
  7. 验证启用了不安全的HTTP方法
  8. c++ ptree判断是否存在节点_CTreeCtrl 查找 等于某值 的节点,并设置为高亮
  9. 合并相同数据的行_R语言笔记(六):数据框重塑(reshape2)
  10. 大咖博闻荟 | 基于NSX-T和AVI实现企业双活中心
  11. pat编程语言_浙江大学在线pat题库集合
  12. 计算机专业教研成绩,2018学年第一学期计算机组教研组工作计划
  13. 关于返回一个整数数组中最大子数组的和的问题(续01)
  14. 菜鸟学开店—最简收银POS系统
  15. 网络工程师HCIE-RS-layer2(原理+实验)
  16. DevExpress ChartControl 实现多轴
  17. 老虎并不吃老虎,只有人用人来养肥自己
  18. 【时间之外】10分钟搞懂Python+Tushare+Excel股票分析
  19. linux源码网址,可以在这里找到很多开源的驱动
  20. 2023最新SSM计算机毕业设计选题大全(附源码+LW)之java疫情下校园食品安全信息管理系统4r61l

热门文章

  1. 可再生能源专刊Special issue for Renewable Energy
  2. python数据按照分组进行频数_Pandas:按两列分组并计算第二列中所有值的出现次数...
  3. Elektrobit(EB)官方试用版软件
  4. 【mysql】mysql调优时必须掌握的慢查询语句排查命令
  5. 浅谈axios的拦截器
  6. 数通工程师就业方向有多大?看他们在成都高薪就业的岗位就知道!
  7. 益和VA虚拟文件夹群发文件的改进
  8. 中国农业银行 云 BMP 二维码支付商户接入
  9. 哪些模块可用于python性能分析_4-Python内置类型性能分析
  10. 计算直柱体的面积和体积