Docker Community Forums

Share and learn in the Docker community.

ASP NET Core MVC app - cannot open on localhost


(Bartekpokerbartek) #1

Hello,
this is my first post here, so I’d like to welcome everybody. I have problem with opening my ASP NET Core app on docker. Could anybody advise on what I’m doing wrong or how to proceed? Steps to reproduce:

  1. ‘docker pull microsoft/dotnet’
  2. ‘docker run -it -p 5050:5050 microsoft/dotnet’
  3. ‘mkdir app’, ‘cd app’, ‘dotnet new mvc’, ‘dotnet build’, ‘dotnet run’ which gives me following out (which I assume is correct?):
Summary

Using launch settings from /app/Properties/launchSettings.json…
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using ‘/root/.aspnet/DataProtection-Keys’ as key repository; keys will not be encrypted at rest.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
Creating key {459b6d34-7807-4961-9906-0b57a0973c85} with creation date 2018-07-31 21:41:09Z, activation date 2018-07-31 21:41:09Z, and expiration date 2018-10-29 21:41:09Z.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {459b6d34-7807-4961-9906-0b57a0973c85} may be persisted to storage in unencrypted form.
info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
Writing data to file ‘/root/.aspnet/DataProtection-Keys/key-459b6d34-7807-4961-9906-0b57a0973c85.xml’.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https 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’.
Hosting environment: Development
Content root path: /app
Now listening on: https localhost:5001
Now listening on: http localhost:5000
Application started. Press Ctrl+C to shut down.

Now I’m trying to open my app through browser, but I’m not able to (I try localhost:5050, also localhost:5000, but think that first one is correct?)

Below output from ‘docker ps’ and ‘docker info’:

Summary

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cf6c54b4da9a microsoft/dotnet “bash” 8 minutes ago Up 8 minutes 0.0.0.0:5050->5050/tcp elated_johnson

Containers: 2
Running: 2
Paused: 0
Stopped: 0
Images: 5
Server Version: 18.06.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.93-linuxkit-aufs
Operating System: Docker for Windows
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: linuxkit-00155d300001
ID: 6KBL:DHCR:RDIA:OXAX:TQ3K:45NM:GB25:ZHI3:ET3G:EOLP:MTHK:BXZD
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 38
Goroutines: 68
System Time: 2018-07-31T21:48:42.8010875Z
EventsListeners: 1
Registry: https index docker io / v1 /
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false


(Choppyfish46) #2

check ip address of container
docker-mchine ls
http://whateverisip:port number
try it and let me know


(Bartekpokerbartek) #4

That’s strange, ‘docker-machine ls’ gives empty output (I’m running it on Win10). Could this be the case?

Maybe it is connected somehow with Hyper-V as I can see in manager that there is no IP assigned to DocketNAT?