Dotnet-docker: New Develop .NET Core Applications in a Container instructions don't work

Created on 24 Sep 2019  Â·  9Comments  Â·  Source: dotnet/dotnet-docker

Steps to reproduce the issue

  1. from C:\git:
    git clone https://github.com/dotnet/dotnet-docker/
  2. docker run --rm -it -p 8000:80 -v ~/git/dotnet-docker/samples/aspnetapp:/app/ -w /app/aspnetapp mcr.microsoft.com/dotnet/core/sdk:3.0 dotnet watch run (edited from previous incorrect docker run command)
    3.

Expected behavior

application is accessible at http://localhost:8000

Actual behavior

no application is accessible

Additional information (e.g. issue happens only occasionally)

Attempted with two separate windows 10 machines using linux and windows containers

Output of docker version

PS C:\git> docker version
Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:26:49 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfc
  Built:            Thu Aug 29 05:32:21 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info

PS C:\git> docker info
Client:
 Debug Mode: false

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 19.03.2
 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 ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.9.184-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.952GiB
 Name: docker-desktop
 ID: S3BO:CNNR:SHY4:KC3I:IOHW:IM4Z:TWOM:IGWP:EQGO:VPAE:PCLJ:3RRW
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 37
  Goroutines: 58
  System Time: 2019-09-24T02:32:04.5551401Z
  EventsListeners: 1
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
area-samples bug

All 9 comments

Also tested in ubuntu 19.04 (Pop_OS)

Docker version output

Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfca03
 Built:             Thu Aug 29 05:29:17 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfca03
  Built:            Thu Aug 29 05:27:52 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Docker info output

Client:
 Debug Mode: false

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 2
 Server Version: 19.03.2
 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 ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.0.21-050021-generic
 Operating System: Pop!_OS 19.04
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 31.15GiB
 Name: pop-os
 ID: G5NM:PQFD:ZFCQ:7DGW:L5SL:4LC3:ZOL2:HGK7:RPD2:MO72:VVSK:EJCN
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

@rparsonsbb - Per your Steps to reproduce the issue, you are running the dotnetapp. This is a console app and will not be available via http. Did you intend to use the aspnetapp? When using an aspnetapp, remember to specify the port to expose e.g. -p 8000:80.

Yeah sorry copied the wrong line when opening the original issue.

 ~   docker run --rm -it -p 8000:80 -v ~/git/dotnet-docker/samples/aspnetapp:/app/ -w /app/aspnetapp mcr.microsoft.com/dotnet/core/sdk:3.0 dotnet watch run watch : Polling file watcher is enabled watch : Started 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 {9d8deb84-b61c-4524-84a1-d9ac84efdad7} 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'. info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000 info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:5001 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: /app/aspnetapp info: Microsoft.Hosting.Lifetime[0] Application is shutting down... watch : Exited watch : File changed: /app/aspnetapp/Views/Home/Index.cshtml watch : Started

image

This looks suspicious to me Unable to bind to http://localhost:5000 on the IPv6 loopback interface.... The port seems to be used. Have you tried changing the port or simply removing the applicationUrl setting in the launchSettings.json?

I found this thread - dotnet watch run doesn't plays nicely with localhost type urls. There are some workaround.

While not totally IPv4 vs IPv6 savvy, I'm assuming that the failure on the IPv6 rail doesn't interfere with the IPv4 as you can see it listening in the next two lines.

I'm certainly continuing to troubleshoot myself but I'd expect two commands in a readme to function correctly :/ once I get it working if it hasn't been corrected in the documentation I'll submit a PR

Can you point me where in the readmes you are referring to? IIRC the dev-in-container readme is focused on the console app scenario. Regardless I would expect 'similar' steps would work for ASP.NET Core apps.

This is a regression caused from #1322.

Was this page helpful?
0 / 5 - 0 ratings