Search code examples
dockerdocker-composeasp.net-core-2.1

Can not run docker container from compose


I can not run a Net Core application in docker-compose due to this error,while i can start the container from dockerfile.

Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
  https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

My dockerfile uses the .dll directly (i am directly using the publish directory), so no build ,restore is required.

FROM microsoft/dotnet:aspnetcore
WORKDIR /app
COPY ./publish .
ENTRYPOINT ["dotnet", "Server.dll"]
EXPOSE 8202

I run:
docker build -t mp . docker run --name mp0 -d myimg and it works.
However when i am running it from compose :

 mp:
        image: mp
        container_name: mp0
        build: ./mpbuild
        ports:
          - 8302:8202

I have tried using :aspnetcore,aspnetcore-build,aspnetcore-runtime to no avail .I keep getting asked about the SDK.

P.S: The app is version aspnetcore 2.1.


Solution

  • try changing microsoft/dotnet:aspnetcore to microsoft/dotnet:2.2-sdk