I'm try create a container with dotnet api, but, after the build and use the docker run command, it not access. I need understand where mistakes occurred to fix it.
My some distro is Ubuntu, using docker version 18.09.5 and used the images for create Dockerfile:
microsoft/dotnet:2.2-sdk-alpine microsoft/dotnet:2.2-aspnetcore-runtime-alpine
The dockerfile content:
FROM microsoft/dotnet:2.2-sdk-alpine AS build-env
WORKDIR /app
ENV ASPNETCORE_URLS http://0.0.0.0:5000
COPY source/*.csproj ./
RUN dotnet restore
COPY source/ ./
RUN dotnet publish -c Release -o out
FROM microsoft/dotnet:2.2-aspnetcore-runtime-alpine
WORKDIR /app
COPY --from=build-env /app/out .
EXPOSE 5000
ENTRYPOINT ["dotnet", "devops-test.dll", "--urls", "http://0.0.0.0:5000"]
Command for build:
docker build -t freitas/apidotnet .
Commando for run the app:
docker run -it -p 5000:5000 freitas/apidotnet
After run, this message are show:
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {09e12a74-3a22-4ff3-b882-3f546d91d02a} may be persisted to storage in unencrypted form.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Address not available'.
Hosting environment: Production
Content root path: /app
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
But, i try access the browser http://localhost:5000 or use the postman to get api, but not response.
I don't have idea for this. Sorry for my bad english and thanks for help.
http://::1:5000
– DavidG