簡體   English   中英

帶有 dotnet 的 alpine docker 圖像看不到我的應用程序

[英]alpine docker image with dotnet doesn't see my app

我正在嘗試使用 Alpine Linux docker 映像運行我的 dotnet 5 單文件應用程序。 這是我的 Dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine    
WORKDIR /app
COPY ["Service.Translations", "/app/Service.Translations"]

CMD ["./Service.Translations", "--urls", "http://0.0.0.0:5000"]

這是依賴於框架的應用程序。 也試過自包含,結果是一樣的:沒有找到。 Dotnet 看不到我的文件,sh 也看不到。

是因為我在 Windows 上構建了我的應用程序嗎? 帶有 alpine compile app inside image 的所有教程。 如果我將 Alpine 更改為 Ubuntu 或其他 - 一切正常。

更新:好的,問題出在發布上。 我不得不將 --runtime 更改為 linux-musl-x64 而不是 linux-x64

我發現了問題。 Alpine Linux 使用 musl c 庫,它使標准 dotnet 構建與此 linux 發行版不兼容。 Visual Studio 沒有所有發布運行時選項。 在這里https://docs.microsoft.com/en-us/dotnet/core/rid-catalog你可以找到所有這些。 所以對於 alpine linux 我們必須使用 linux-musl-x64 運行時而不是 linux-x64

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM