前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Docker创建manifest镜像

Docker创建manifest镜像

作者头像
tanmx
发布2023-10-18 12:49:11
2660
发布2023-10-18 12:49:11
举报

构建镜像

首先在 amd64 机器构建 lovelonger**/**perf-test:amd 镜像,然后在 arm64 机器构建 lovelonger/perf-test:arm 镜像,构建完成 push 到 dockerhub。

需要注意的是,manifest文件仅仅是针对于已经在仓库中的镜像!!! 换句话说,就是这个镜像是刚从仓库中pull下来的!如果这个镜像是自己build的,需要先push到仓库中,否则,这个镜像是没有manifest文件的!!同样的,如果你pull了一个镜像,tag了一下,再去看这个manifest文件,也是没有的,因为tag后的镜像不在镜像仓库中。

创建 manifest 列表

1 2 3 4

# docker manifest create MANIFEST_LIST MANIFEST [MANIFEST...] # docker manifest create lovelonger/perf-test \ lovelonger/perf-test:amd \ lovelonger/perf-test:arm

当要修改一个 manifest列表时,可以加入 -a--amend参数。

设置 manifest 列表

1 2 3 4 5 6 7 8

# docker manifest annotate [OPTIONS] MANIFEST_LIST MANIFEST # docker manifest annotate lovelonger/perf-test \ lovelonger/perf-test:amd \ --os linux --arch amd64 # docker manifest annotate lovelonger/perf-test \ lovelonger/perf-test:arm \ --os linux --arch arm64 --variant v8

查看 manifest 列表

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

# docker manifest inspect lovelonger/perf-test # docker manifest inspect lovelonger/perf-test { "schemaVersion": 2, "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", "manifests": [ { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 947, "digest": "sha256:975589cae8ea492aac12a29d11cf31578a45ca92c32b599ac1030890d9f1e66a", "platform": { "architecture": "amd64", "os": "linux" } }, { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "size": 947, "digest": "sha256:d6bc0f26dc4d8746e7b60df59269c66840e4681f8af613d1da9b16884e402133", "platform": { "architecture": "arm64", "os": "linux", "variant": "v8" } } ] }

推送 manifest 列表

1

# docker manifest push lovelonger/perf-test

推送后可以在 dockerhub 看到详情

https://cdn.jsdelivr.net/gh/tanmx/pic@main/2022/05/PVNygw.png
https://cdn.jsdelivr.net/gh/tanmx/pic@main/2022/05/PVNygw.png

测试

x84_64 机器上面测试

1 2 3 4 5 6 7 8 9 10

# docker run -ti --rm lovelonger/perf-test:latest echo ;uname -a Unable to find image 'lovelonger/perf-test:latest' locally latest: Pulling from lovelonger/perf-test 2408cc74d12b: Pull complete 9d980ba59630: Pull complete a036d2a6b4b7: Pull complete Digest: sha256:df7c8738c9d7e3ce5058c90dd7b68dce874e4f454ee09bc28edc2727902c6ba5 Status: Downloaded newer image for lovelonger/perf-test:latest Linux crawler-sel 5.13.0-1027-oracle #32~20.04.1-Ubuntu SMP Fri Apr 15 05:59:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

arm64 机器上面测试

1 2 3 4 5 6 7 8 9 10

# docker run -ti --rm lovelonger/perf-test:latest echo ;uname -a Unable to find image 'lovelonger/perf-test:latest' locally latest: Pulling from lovelonger/perf-test b3c136eddcbf: Already exists abd313fa511b: Pull complete a036d2a6b4b7: Pull complete Digest: sha256:df7c8738c9d7e3ce5058c90dd7b68dce874e4f454ee09bc28edc2727902c6ba5 Status: Downloaded newer image for lovelonger/perf-test:latest Linux fc17e6a10e93 5.13.0-1021-oracle #26~20.04.1-Ubuntu SMP Mon Mar 7 14:30:17 UTC 2022 aarch64 Linux

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022-05-31,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 构建镜像
  • 创建 manifest 列表
  • 设置 manifest 列表
  • 查看 manifest 列表
  • 推送 manifest 列表
  • 测试
相关产品与服务
容器镜像服务
容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档