Docker 错误:dotnet-file.dll 不存在
Docker errror: dotnet-file.dll does not exist
我已经成功构建了我的应用程序并且列出了图像 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.
Docker 文件:
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
Linux 区分大小写,因此您的 ENTRYPOINT 必须是
ENTRYPOINT ["dotnet", "UploadCore.dll"]
您的第二个 docker run
命令有效。您可以使用 --name
选项添加容器名称,例如
docker run -p 5000:80 --name mycontainer my-app:2.7
图像名称必须是第一个不可选的参数。在您的第一个 docker run
命令中,第一个是 uploadcore
,因此 docker 查找名为该图像的图像,但找不到它。
我已经成功构建了我的应用程序并且列出了图像 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.
Docker 文件:
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
Linux 区分大小写,因此您的 ENTRYPOINT 必须是
ENTRYPOINT ["dotnet", "UploadCore.dll"]
您的第二个 docker run
命令有效。您可以使用 --name
选项添加容器名称,例如
docker run -p 5000:80 --name mycontainer my-app:2.7
图像名称必须是第一个不可选的参数。在您的第一个 docker run
命令中,第一个是 uploadcore
,因此 docker 查找名为该图像的图像,但找不到它。