Home > Software design >  Docker errror: dotnet-file.dll does not exist
Docker errror: dotnet-file.dll does not exist

Time:05-16

I have successfully builded my app and there is image listed my-app:2.7 But when I try to run it error says:

Any idea where is wrong?

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"]

Files structure

Context 
Controllers 
Migrations  
Models  
Properties  
Service 
Views
wwwroot
Program.cs
Startup.cs
UploadCore.csproj
appsettings.Development.json
appsettings.json
libman.json     

CodePudding user response:

Linux is case sensitive, so your ENTRYPOINT has to be

ENTRYPOINT ["dotnet", "UploadCore.dll"]

Your second docker run command works. You can add a container name with the --name option like this

docker run -p 5000:80 --name mycontainer my-app:2.7

The image name has to be the first parameter that isn't an option. In your first docker run command, the first one is uploadcore, so docker looks for an image called that and it can't find it.

  • Related