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
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’.
To fix this locate the launchSettings.json file located in the Properties folder of your .net core app. You should see 2 entries 1. iisSettings 2. profiles. Under profiles the first profile should be IIS Express and the second should bear the name of your .net core app. Change the value of applicationUrl to