我们正在构建一个 .net 5.0 gRPC 服务,并使用以下命令尝试在我的开发机器(带有 Docker Desktop 的 Windows 10)上为 Linux 创建 docker 映像,效果很好:
docker build --platform=linux 。 -t repo:imagename --no-cache
问题是我们的 CI/CD 管道使用 Windows Server 2019 并且无法安装 Docker 桌面,所以我按照以下步骤操作:
Docker Linux 容器在 Windows Server 2019 上运行
,这似乎可以在服务器上运行 Linux 映像,但不能构建它们?这可能吗?
docker 版本给出:

您可以看到 docker 服务器的操作系统/Arch 是 windows,甚至使用 lcow 也无法将其变为 linux,
因此构建会出现以下错误:
无法获取目标图像“sha256:guid”:找到了引用 sha256:guid 的图像,但与指定的平台不匹配:想要 linux/amd64,实际:windows/amd64
感谢任何帮助
We are building a .net 5.0 gRPC service and using the below command trying to create docker image for linux on my dev machine (windows 10 with Docker Desktop) works just fine:
docker build --platform=linux . -t repo:imagename --no-cache
the issue is that our CI/CD pipeline uses windows server 2019 and Docker desktop cannot be installed, so I followed this:
Docker Linux Container running on Windows Server 2019
and that seems to work to run linux images on the server but not to build them? Is this even possible?
docker version gives:

you can see that the OS/Arch is windows for the docker server and even using lcow cannot get it to be linux
so building gives the following error:
failed to get destination image "sha256:guid": image with reference sha256:guid was found but does not match the specified platform: wanted linux/amd64, actual: windows/amd64
Any help is appreciated
发布评论