我已經成功構建了我的應用程式并列出了影像my-app:2.7
但是當我嘗試運行它時,錯誤說:
知道哪里錯了嗎?
docker run -it --rm -p 5000:80 --name my-app:2.7 uploadcore Unable to find image 'uploadcore:latest' locally docker: Error response from daemon: pull access denied for uploadcore, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'.
docker run -p 5000:80 my-app:2.7 Could not execute because the specified command or file was not found. Possible reasons for this include: You misspelled a built-in dotnet command. You intended to execute a .NET program, but dotnet-uploadcore.dll does not exist. You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Dockerfile:
FROM mcr.microsoft.com/dotnet/nightly/sdk:6.0 AS base
WORKDIR /app
EXPOSE 59518
EXPOSE 44364
FROM mcr.microsoft.com/dotnet/nightly/sdk:6.0 AS build
WORKDIR /src
COPY UploadCore/UploadCore.csproj UploadCore/
RUN dotnet restore UploadCore/UploadCore.csproj
COPY . .
WORKDIR /src/UploadCore
RUN dotnet build UploadCore.csproj -c Release -o /app
FROM build AS publish
RUN dotnet publish UploadCore.csproj -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "uploadcore.dll"]
檔案結構
Context
Controllers
Migrations
Models
Properties
Service
Views
wwwroot
Program.cs
Startup.cs
UploadCore.csproj
appsettings.Development.json
appsettings.json
libman.json
uj5u.com熱心網友回復:
Linux 區分大小寫,因此您的 ENTRYPOINT 必須是
ENTRYPOINT ["dotnet", "UploadCore.dll"]
您的第二個docker run命令有效。--name您可以使用這樣的選項添加容器名稱
docker run -p 5000:80 --name mycontainer my-app:2.7
影像名稱必須是第一個不是選項的引數。在您的第一個docker run命令中,第一個命令是uploadcore,因此 docker 會查找名為 that 的影像,但找不到它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/475668.html
上一篇:設定html后添加事件的正確方法
下一篇:如何在.NET6中注冊動作過濾器
