Reputation: 61
Here is my Dockerfile:
FROM microsoft/aspnetcore-build:1.0 AS build-env
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# build runtime image
FROM microsoft/aspnetcore:1.0
WORKDIR /app
COPY --from=build-env /app/out .
EXPOSE 58912
ENTRYPOINT ["dotnet", "SgaApi.dll"]
I used this command to build: docker build -f Dockerfile -t sga .
Run: docker run -e "ASPNETCORE_URLS=http://+:58912" -it --rm sga
Application starts successfully
I can't access it from the browser. When I run the application using "dotnet run" it works fine.
Upvotes: 3
Views: 1677
Reputation: 14024
You have exposed the port, but you haven't published it. You can either use -P to publish all exposed ports or -p and then specify port mapping. For example:
docker run -p 58912:58912 -e "ASPNETCORE_URLS=http://+:58912" -it --rm sga
Upvotes: 4