Docker Mac M1问题:找不到匹配的清单

huangapple go评论99阅读模式
英文:

Docker Mac M1 issue No matching for manifest

问题

Dockerfile:1

1 | >>> FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine
2 | VOLUME /tmp
3 | COPY build/libs/*.jar myapp.jar

> ERROR: failed to solve: adoptopenjdk/openjdk11:jre-11.0.11_9-alpine:
> no match for platform in manifest
> sha256:ed7ea16ca04b09cb381a094dff07c5d5ce5f0ead97540fcfc4b67c054e25e217:
> not found

任何关于这个问题的帮助都会很有帮助。我正在使用 Mac M1 并在执行 Dockerfile 时遇到这个错误。

在执行调用 Dockerfile 的脚本文件时出现此错误。

FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine
VOLUME /tmp
COPY build/libs/*.jar myapp.jar
ENTRYPOINT ["java", "-Xmx800m", "-XX:+UseG1GC", "-jar", "-Dspring.profiles.active=cloud", "/myApp.jar"]

在 Windows 系统上,相同的脚本可以正常执行。

英文:
Dockerfile:1
--------------------
   1 | >>> FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine
   2 |     VOLUME /tmp
   3 |     COPY build/libs/*.jar myapp.jar
--------------------

> ERROR: failed to solve: adoptopenjdk/openjdk11:jre-11.0.11_9-alpine:
> no match for platform in manifest
> sha256:ed7ea16ca04b09cb381a094dff07c5d5ce5f0ead97540fcfc4b67c054e25e217:
> not found

Any help on this issue.I am using Mac M1 and docker getting this error while executing docker file.

I am getting this error while executing a script file which is calling the docker file.

FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine
VOLUME /tmp
COPY build/libs/*.jar myapp.jar
ENTRYPOINT ["java", "-Xmx800m", "-XX:+UseG1GC", "-jar", "-Dspring.profiles.active=cloud", "/myApp.jar"]

The same script is executing well in windows system

答案1

得分: 0

M1 MacWindows 的架构不同,这是错误的原因。

错误信息意味着你正在尝试的镜像在 Macbook 上不可用。我猜是 OS/ARCH : linuxamd64

检查 OS/ARCHARM,它将可用。

在这里检查所有可用的 ARM 选项:https://hub.docker.com/r/adoptopenjdk/openjdk11/tags?page=1&name=jre-11

根据需要选择适合你的 Slim, nightly 版本。

更新

正如Rick提到的,你可以使用 --platform 并进行交叉运行,但可能存在 兼容性,性能 的问题。

建议在可能的情况下始终使用 本地镜像 来获得 性能兼容性

如果在 Mac 上构建多平台镜像,可以使用 buildx 来构建你的 Docker 镜像。

英文:

The architecture for the M1 Mac and Windows is diff that's the reason behind the error.

> adoptopenjdk/openjdk11:jre-11.0.11_9-alpine: no match for platform in
> manifest

Above error mean the image that you are trying is not available for playgform Macbook. i guess it is OS/ARCH : linuxamd64

Check for the OS/ARCH : ARM and it will work.

Check here all available ARM options : https://hub.docker.com/r/adoptopenjdk/openjdk11/tags?page=1&name=jre-11

Which is suitable for you Slim, nightly release as per need.

Update :

As Rick mentioned you can use the --platform and cross-run it, but there could be chances of Compatibility, Performance.

Recommended is to use native images whenever possible for performance and compatibility.

you can build your docker image with buildx if building on Mac creates Multi-platform images.

huangapple
  • 本文由 发表于 2023年8月10日 16:28:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76873926.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定