如何列出ARM64的Docker图像?

发布于 2025-02-02 17:35:38 字数 507 浏览 6 评论 0原文

我拥有Mac M1,然后在上面运行Docker。 在OSX上,Docker可以运行本地手臂图像,但还可以模拟X86/AMD64以运行未为ARM构建的图像。

从命令行中,如何找到显示图像平台的命令“ Docker Image LS”的扩展?

$ docker image ls

REPOSITORY   TAG     **PLATFORM**  IMAGE ID   CREATED   SIZE  
.............................arm64  
.............................x86  

我已经看到了这个答案:如何通过平台过滤码头图像?但这没有回答这个问题。操作系统和平台是两件事。

I own a Mac M1 and I run Docker on it.
On OSX, Docker can run native ARM images but also emulate x86/amd64 to run images that were not built for ARM.

From the command line, how do I find an extension of the command 'docker image ls' which displays the image platform?

$ docker image ls

REPOSITORY   TAG     **PLATFORM**  IMAGE ID   CREATED   SIZE  
.............................arm64  
.............................x86  

I already saw this answer: How to filter Docker images by platform? but it does NOT answer the question. OS and PLATFORM are two different things.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

审判长 2025-02-09 17:35:38

这是您想要的吗?

docker image inspect \
  --format "{{.ID}} {{.RepoTags}} {{.Architecture}}" \
  $(docker image ls -q)

输出:

sha256:fb495265b81ffaa0d3bf8887231b954a1139b2e3d611c3ac3ddeaff72313909c [postgres:10.11-alpine] amd64

说明:

  • $(Docker Image LS -Q)→将所有图像ID作为参数传递到检查命令
  • Docker Image Inspect打印有关图像的详细信息

,也可以使用grep {Inspect> {Inspect command} |添加管道。 EGREP'amd64 $'仅打印amd64架构。

Is this what you looking for?

docker image inspect \
  --format "{{.ID}} {{.RepoTags}} {{.Architecture}}" \
  $(docker image ls -q)

output:

sha256:fb495265b81ffaa0d3bf8887231b954a1139b2e3d611c3ac3ddeaff72313909c [postgres:10.11-alpine] amd64

Explanation:

  • $(docker image ls -q) → pass all image IDs as parameters to inspect command
  • docker image inspect print detailed info about image

Also it is possible to add pipe with grep, like {inspect command} | egrep 'amd64$' to print only amd64 architecture for example.

小镇女孩 2025-02-09 17:35:38

尝试将Docker ImageJQ

docker image inspect \
    $(docker images -q) \
    | jq -r '.[] | select(.Architecture=="arm64").RepoTags[]'

Try to combine docker image with jq :

docker image inspect \
    $(docker images -q) \
    | jq -r '.[] | select(.Architecture=="arm64").RepoTags[]'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文