1、manifest是什么,干什么用?
manifest是一个文件,这个文件包含了有关于镜像信息,如层、大小和摘要。docker manifest命令还向用户提供附加信息,比如构建镜像的操作系统和体系结构。而manifest list是一个镜像清单列表,用于存放多个不同os/arch的镜像信息。我们可以创建一个manifest list来指向两个镜像(一个linux 64位和一个指向arm64位的镜像),然后对用户提供一个唯一的镜像名称。从Docker registry v2.3和Docker 1.10 开始,Docker hub就可以pull multi architecture Docker镜像了。
一个镜像的manifest文件信息如下:
一个manifest list的例子如下:
注意:manifest的功能目前仅仅作用于docker 官方的镜像仓库。
总结:简单的说manifest list就是多个manifest的一个集合,通过列表方式来管理。
2、manifest list处理流程:
manifest-2.jpg
docker-manifest.png
3、开启docker子命令manifest功能:
manifest是做为docker客户端的子命令存在,不过这个子命令目前处在实验性中一般没有开启。我们需要手动开始这个子命令的功能。开启过程如下:
1)、编辑配置文件config.json应用实验性功能:
docker 的默认配置文件config.json是在$HOME目录下的.docker目录下。编辑config.json文件,若目录和文件不存在手动创建。
2)、编辑守护进程配置文件daemon.json开启实验性功能:
编辑daemon.json,若目录和文件不存在手动创建
3)、重启docker:
开启docker的实验性功能后docker pull可以拉取指定平台镜像如下:
4、使用manifest创建多CPU架构的镜像:
查看一个镜像的manifest文件信息
$docker manifest inspect java
查看一个镜像的manifest文件的详细信息包括cpu平台架构等信息
$docker manifest inspect --verbose java
这里准备好了两个不同CPU架构的镜像如下:
这里的镜像是自己在docker hub上创建的仓库
xxx/public_docker:nginx-arm64
xxx/public_docker:nginx-x86
将上面两个镜像推到docker hub上面
1)、创建一个manifest list列表:
创建一个自定义命名的镜像名的manifest list,然后用该列表关联仓库里面的两个不同架构的镜像
$docker manifest create xxx/public_docker:nginx-v1 xxx/public_docker:nginx-arm64 xxx/public_docker:nginx-x86
2)、将创建好的manifest list 推到仓库中:
$docker manifest push xxx/public_docker:nginx-v1
3)、查看仓库中创建好的manifest list:
$docker manifest inspect xxx/public_docker:nginx-v1