通过 Docker 将 .net 应用程序部署到 Kubernetes
我正在尝试将 .net 应用程序部署到 Digital Ocean Kubernetes,但运气不佳。创建简单的 web.yml 部署时,我看到状态日志返回 ERROR
并且在 pod 上运行日志时,我看到以下内容:
standard_init_linux.go:228: exec user process caused: exec format error
我已经围绕此错误进行了一些研究,看来我的架构不匹配。然而,我的 Digital Ocean 集群 99.999% 的架构是 AMD,并且我从以下 Dockerfile 构建的映像是 linux/arm64/v8。
我有以下 Dockerfile:
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
# copy everything else and build app
COPY . .
RUN dotnet restore
WORKDIR /app/ASCOM.Alpaca.Simulators
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /app/ASCOM.Alpaca.Simulators/out ./
我通过标准 docker compose build 命令构建并推送到我的 docker hub。
我查看了一些关于如何将其构建为 AMD 或其他的在线参考资料,但目前我似乎无法参考可行的潜在解决方案。
我有以下 docker-compose.yaml 文件:
version: "3.9"
services:
web:
build: .
ports:
- "80:32323"
image: observerly/ascom-alpaca:latest
command: ["dotnet", "ascom.alpaca.simulators.dll", "--urls=http://*:32323"]
我已经看到了有关 buildkit 的主题...但我还没有真正能够理解为 .net core 构建不同的 arch 映像所需采取的确切步骤。
我运行了 docker Manifest Inspect --verbose mcr.microsoft.com/dotnet/aspnet:6.0 ,这给了我可以使用 AMD64 的提示:
"platform": {
"architecture": "amd64",
"os": "linux"
}
任何专业提示都会很棒!
I'm attempting to deploy a .net Application to Digital Ocean Kubernetes, put to no luck. When creating a simple web.yml deployment I am seeing the status log return ERROR
and when running logs on the pod I see the following:
standard_init_linux.go:228: exec user process caused: exec format error
I have done some research around this error, and it seems that my architecture is mismatched. However, I'm 99.999% my architecture my Digital Ocean cluster is AMD, and the image I have built from the following Dockerfile is linux/arm64/v8.
I have the following Dockerfile:
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /app
# copy everything else and build app
COPY . .
RUN dotnet restore
WORKDIR /app/ASCOM.Alpaca.Simulators
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /app/ASCOM.Alpaca.Simulators/out ./
Which I build and push to my docker hub via the standard docker compose build
command.
I've looked a few few online references around how to potentially build this as AMD, or other, but I currently can't seem to reference a working potential solution.
I have the following docker-compose.yaml file:
version: "3.9"
services:
web:
build: .
ports:
- "80:32323"
image: observerly/ascom-alpaca:latest
command: ["dotnet", "ascom.alpaca.simulators.dll", "--urls=http://*:32323"]
I have seen topics around buildkit ... but I haven't really been able to understand the exact steps I need to take to build a different arch image for .net core.
I've run docker manifest inspect --verbose mcr.microsoft.com/dotnet/aspnet:6.0
which gives me the hint that AMD64 can be used:
"platform": {
"architecture": "amd64",
"os": "linux"
}
Any pro-tips would be amazing!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论