Docker Community Forums

Share and learn in the Docker community.

Run .Net core application inside a docker

Hi all,
I’m trying to deploy .net core application on docker image.
My steps are in following sample link

https://stormpath.com/blog/tutorial-deploy-asp-net-core-on-linux-with-docker

However once I map the port 8080 I can connect to the localhost.
bellow warnings are coming at container startup
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to "http:localhost:5001 on the IPv6 loopback interface: ‘Cannot assign requested address’.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http:localhost:5000 on the IPv6 loopback interface: ‘Cannot assign requested address’.

docker ps output
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
468fe048a774 mydemos:aspnetcorehelloworld “dotnet run” 13 minutes ago Up 13 minutes 0.0.0.0:8080->5000/tcp tender_torvalds

Any support highly appreciated

I’m stuck any support appreciated

Changing the urls settings did the trick for me:
In hosting.json:

{
    "urls": "http://*:5000/;"
}
``
FYI: I had the same error with `localhost` and after I changed it to `127.0.0.1` the error was not logged anymore - however I could still not connect until I set the host to `*`.
I think the host part of the urls restricts how the server is accessed, and since you are not accessing the server from within the docker container `127.0.0.1` will not work.

Did you manage to fix this,i cant run my image
I am getting this

warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory ‘/root/.aspnet/DataProtection-Keys’ that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {2baeaa54-a2c8-4e72-b22a-d4f3e264efe9} 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: ‘Cannot assign requested address’.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv6 loopback interface: ‘Cannot assign requested address’.

========================