-1

I'm trying to make an Windows Nano Server container that runs an ASP.NET Core app.
I'm building it on Windows Server 2016. I can make it work, but there is one odd problem.

The only way I can make it work is to build the image, run the container, then start an interactive Powershell session and use Invoke-WebRequest http://localhost:5000. Once I do that, the app is visible from other servers (I can't browse the container locally from the Win2016 Server due to a known NAT bug.)

Here's my Dockerfile:

FROM microsoft/dotnet:sdk-nanoserver
ARG source
WORKDIR /app
COPY /ContainerPOC/ .
RUN dotnet restore --runtime win10-x64 .

RUN dotnet build --framework netcoreapp1.1 --runtime win10-x64 .

EXPOSE 5000
ENV ASPNETCORE_URLS http://0.0.0.0:5000
CMD dotnet run --framework netcoreapp1.1

Any idea why this won't "just work?"

2
  • What's happening in the other ways? May 18, 2017 at 4:27
  • If I don't do the Invoke-WebRequest, the app doesn't respond to requests from outside. May 18, 2017 at 5:50

2 Answers 2

1

As it is unclear what command and subcommands you used to run the docker container it could be possible that you run the container without using the -p subcommand. In this case docker run -p 5000:5000 <image_name> could solve the issue.

-1

You need run entrypoint like as:

FROM microsoft/aspnetcore:1.1.1
...

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.