Closed darius-khll closed 6 years ago
Can you share more information about which images you are using? I suspect you are using microsoft/dotnet
when you actually need to use microsoft/aspnetcore
. If so, this bug is a duplicate of https://github.com/aspnet/aspnet-docker/issues/286
Everything is default and I did not change anything after visual studio docker support tooling added these specific files
Docker file
FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80
FROM microsoft/aspnetcore-build:2.0 AS build WORKDIR /src COPY *.sln ./ COPY WebApplication1/WebApplication1.csproj WebApplication1/ RUN dotnet restore COPY . . WORKDIR /src/WebApplication1 RUN dotnet build -c Release -o /app
FROM build AS publish RUN dotnet publish -c Release -o /app
FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "WebApplication1.dll"]
I just want to start that image manually without visual studio
It's possible your machine has a stale version of the microsoft/aspnetcore:2.0
image. Can you run this to see if it resolves the issue?
docker pull microsoft/aspnetcore:2.0
I had that image already, but I pulled it again Unfortunately nothing changed! same error happened.
I found a solution to solve the problem,
The solution is to add <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
to your csjproj files so the dotnet publish bundles all the required files. something like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
...
I created asp.net core 2 app in visual studio and I enabled docker support, everything works fine, I can run it in visual studio and debug it easily. But after changing to release mode and rebuild solution again, I see another image with latest tag that make sense. After running this command I wish I could using this container by it's port
docker run -p 8585:80 webapplication1:latest
Expected behavior
expected to run this docker image successfully
Actual behavior
Output of
dotnet --info
Output of
docker info