英文:
Build an Docker image with Mac M1, push it to Docker Hub : can not use that image on Win 10
问题
docker: 守护程序返回错误响应:找到映像 qwerty22/kube-kompose:pok-0 但与指定平台不匹配:期望为 windows/amd64,实际为 linux/arm64。
这对我来说是新的。我以为 Docker/标准映像是“通用的”。但现在似乎需要为每个平台构建一个映像以便运行?
示例映像是来自 [https://github.com/kubernetes/kompose] 的 kubernetes-kompose。
编辑:我试图在 Win 10 和 Docker 桌面上运行该映像。
所以问题是:我能否在我的 Mac 上构建一个 Docker 映像,将映像推送到 Docker Hub,然后将其拉到 Win 10 上并在那里运行?
我似乎在那方面没有成功。
英文:
docker: Error response form daemon: image witn reference qwerty22/kube-kompose:pok-0 was found but does not match the specified platform: wanted windows/amd64, actula : linux/arm64.
This was new to me. I thought Docker/standard images are "universal". But now it seems that you need to build an image for each platform - to run on ?
Example image was kubernetes-kompose from [https://github.com/kubernetes/kompose]
EDIT: I was trying to run that image on Win 10 and Docker desktop.
So the question is: Can I build a Docker image with my Mac, push the image to Docker Hub, pull image to a Win 10, and run it there?
I did not seem to succeed on that.
答案1
得分: 3
操作系统的构建和运行架构必须兼容。
你应该在Docker桌面上启用Linux容器。要做到这一点,右键单击Docker桌面图标,然后从菜单中选择“切换到Linux容器”。
有关更多详细信息,请查看此指南。
另一种方法是在你的Mac M1上为amd64
构建镜像,方法如下:
docker buildx build --platform linux/amd64 --push -t <registry>/<project-id>/<image>
因为使用Apple Silicon构建的Docker镜像是基于ARM架构的,这可能在部署镜像到Linux或基于Windows的amd64
环境时引发问题。
英文:
The OS architecture of the build and the run must be compatible.
You should turn on Linux containers on Docker desktop. To do that, right-click on Docker desktop icon and select Switch to Linux Containers
from the menu.
For more details check this guide.
Another way is to build the image on your Mac M1 for amd64
like this:
docker buildx build --platform linux/amd64 --push -t <registry>/<project-id>/<image>
because the docker images built with Apple Silicon are ARM-based architecture and this can create issues when deploying the images to a Linux or Windows-based amd64
environment.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论