Reputation: 21
I'm trying to publish a web api on docker based on docker.
I'm using a docker file with the following content :
FROM microsoft/dotnet
COPY . /dotnetapp
WORKDIR /dotnetapp
RUN dotnet restore
EXPOSE 5000
ENTRYPOINT dotnet run
I can build and run the image but i'm not able to acces to web api.
Upvotes: 2
Views: 283
Reputation: 668
Seems like you have to specify which URL Kestrel will listen to otherwise it won't accept any connection outside same container.
So your ENTRYPOINT should be something like
ENTRYPOINT ["dotnet", "run", "--server.urls=http://0.0.0.0:5000"]
Including the –server.urls argument is vital to allow inbound connections from outside container. If not, Kestrel will reject any connection that is not coming from the container, something not really useful…
Reference https://www.sesispla.net/blog/language/en/2016/05/running-asp-net-core-1-0-rc2-in-docker/
Upvotes: 1