Sadly i have to use Windows on my system, so i cannot change it to ubuntu.
I have installed docker for my angular test environments.
I am on windows 11, with WSL2, i had it working before but i’m strongly thinking something in the network start is keeping me from accessing it but what ?
-
Windows firewall is disabled.
-
On a seccond linux console within the host i can curl to my site and see web server responds
-
opening port 127.0.0.1:4400/Login (the normal opening path) doesnt allow me.
-
From windows Telnet putty 127.0.0.1 to port 4400 i get nothing
-
firefox error to site from windows "The connection was reset"
-
chrome error to the site from windows "127.0.0.1 unexpectedly closed the connection."
-
windows antivirus cannot disable it Sentinel One (it is not integrated in our browsers).
-
Docker start
docker run -ti -p 4400:4400 <myimagename> /bin/bash
-
in Linux containter started ng
ng serve --port 4400 --disable-hostcheck
-
i have doubts about my routing table on windows 11, but i dont know how it should be for docker, and perhaps its OK ?
route print (on windows no entries towards docker Gateway ??? )=========================================================================== Interface List 8...c8 d9 d2 2d 7f 69 ......Intel(R) Ethernet Connection (7) I219-LM 1...........................Software Loopback Interface 1 26...00 15 5d 26 4b dd ......Hyper-V Virtual Ethernet Adapter =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.25.0.50 10.25.1.109 25 10.25.0.0 255.255.254.0 On-link 10.25.1.109 281 10.25.1.109 255.255.255.255 On-link 10.25.1.109 281 10.25.1.255 255.255.255.255 On-link 10.25.1.109 281 127.0.0.0 255.0.0.0 On-link 127.0.0.1 331 127.0.0.1 255.255.255.255 On-link 127.0.0.1 331 127.255.255.255 255.255.255.255 On-link 127.0.0.1 331 172.25.48.0 255.255.240.0 On-link 172.25.48.1 5256 172.25.48.1 255.255.255.255 On-link 172.25.48.1 5256 172.25.63.255 255.255.255.255 On-link 172.25.48.1 5256 224.0.0.0 240.0.0.0 On-link 127.0.0.1 331 224.0.0.0 240.0.0.0 On-link 10.25.1.109 281 224.0.0.0 240.0.0.0 On-link 172.25.48.1 5256 255.255.255.255 255.255.255.255 On-link 127.0.0.1 331 255.255.255.255 255.255.255.255 On-link 10.25.1.109 281 255.255.255.255 255.255.255.255 On-link 172.25.48.1 5256 ===========================================================================
-
From windows ports are available ??
C:web>netstat -aon | findstr :4400 TCP 0.0.0.0:4400 0.0.0.0:0 LISTENING 16192 TCP 127.0.0.1:4400 127.0.0.1:53209 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53210 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53211 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53212 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53213 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53214 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53215 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53216 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53217 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53218 TIME_WAIT 0 TCP 127.0.0.1:4400 127.0.0.1:53219 TIME_WAIT 0 TCP [::]:4400 [::]:0 LISTENING 16192 TCP [::1]:4400 [::]:0 LISTENING 17248
-
docker config:
docker inspect elated_babbage[ { "Id": "c008e8a1ea57b598ccc8118f05e9c1604855e120ab880528981eab3cb5dc274f", "Created": "2023-08-08T13:28:16.1821888Z", "Path": "/bin/bash", "Args": [], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 2554, "ExitCode": 0, "Error": "", "StartedAt": "2023-08-24T06:24:36.903499Z", "FinishedAt": "2023-08-24T06:24:32.3210839Z" }, "Image": "sha256:074ef342bd522377a0e0c2f8f5c86f82d147d35019b3af75f15732a372944e87", "ResolvConfPath": "/var/lib/docker/containers/c008e8a1ea57b598ccc8118f05e9c1604855e120ab880528981eab3cb5dc274f/resolv.conf", "HostnamePath": "/var/lib/docker/containers/c008e8a1ea57b598ccc8118f05e9c1604855e120ab880528981eab3cb5dc274f/hostname", "HostsPath": "/var/lib/docker/containers/c008e8a1ea57b598ccc8118f05e9c1604855e120ab880528981eab3cb5dc274f/hosts", "LogPath": "/var/lib/docker/containers/c008e8a1ea57b598ccc8118f05e9c1604855e120ab880528981eab3cb5dc274f/c008e8a1ea57b598ccc8118f05e9c1604855e120ab880528981eab3cb5dc274f-json.log", "Name": "/elated_babbage", "RestartCount": 0, "Driver": "overlay2", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": [ "2d83c745233e9cf15463f0d44ac20636e9aeebee6f7ca1df0e38721bf542c73c", "b6c4ceb4b114676f66bf32131bf91b50a6e3a0185457af5946f5a12d70dab0bb" ], "HostConfig": { "Binds": null, "ContainerIDFile": "", "LogConfig": { "Type": "json-file", "Config": {} }, "NetworkMode": "default", "PortBindings": { "4400/tcp": [ { "HostIp": "", "HostPort": "4400" } ] }, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "ConsoleSize": [ 42, 108 ], "CapAdd": null, "CapDrop": null, "CgroupnsMode": "host", "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "private", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "Isolation": "", "CpuShares": 0, "Memory": 0, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": [], "BlkioDeviceReadBps": [], "BlkioDeviceWriteBps": [], "BlkioDeviceReadIOps": [], "BlkioDeviceWriteIOps": [], "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DeviceRequests": null, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": null, "OomKillDisable": false, "PidsLimit": null, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0, "MaskedPaths": [ "/proc/asound", "/proc/acpi", "/proc/kcore", "/proc/keys", "/proc/latency_stats", "/proc/timer_list", "/proc/timer_stats", "/proc/sched_debug", "/proc/scsi", "/sys/firmware" ], "ReadonlyPaths": [ "/proc/bus", "/proc/fs", "/proc/irq", "/proc/sys", "/proc/sysrq-trigger" ] }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay2/bf4025975b12a8ec4c75dde7a4c858e545cf7f7a896777d46eded75a9582d022-init/diff:/var/lib/docker/overlay2/a51a74e187035ef6fa0146dbc6751bbd949d683e43ab0617a21a7c52c97ea883/diff:/var/lib/docker/overlay2/5d091946c590c1644c54cae8684dd2deb481c20156133f6cdbee4284158ef996/diff", "MergedDir": "/var/lib/docker/overlay2/bf4025975b12a8ec4c75dde7a4c858e545cf7f7a896777d46eded75a9582d022/merged", "UpperDir": "/var/lib/docker/overlay2/bf4025975b12a8ec4c75dde7a4c858e545cf7f7a896777d46eded75a9582d022/diff", "WorkDir": "/var/lib/docker/overlay2/bf4025975b12a8ec4c75dde7a4c858e545cf7f7a896777d46eded75a9582d022/work" }, "Name": "overlay2" }, "Mounts": [], "Config": { "Hostname": "c008e8a1ea57", "Domainname": "", "User": "", "AttachStdin": true, "AttachStdout": true, "AttachStderr": true, "ExposedPorts": { "4400/tcp": {} }, "Tty": true, "OpenStdin": true, "StdinOnce": true, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ], "Cmd": [ "/bin/bash" ], "Image": "batnetwebbase", "Volumes": null, "WorkingDir": "", "Entrypoint": null, "OnBuild": null, "Labels": { "org.opencontainers.image.ref.name": "ubuntu", "org.opencontainers.image.version": "22.04" } }, "NetworkSettings": { "Bridge": "", "SandboxID": "8953b243463252eddf22233ade80a47669e787378ade9e6a45aad6fffa8ee8f1", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": { "4400/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "4400" } ] }, "SandboxKey": "/var/run/docker/netns/8953b2434632", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "189c1570eca54bcf01ea7309a93a7ec4a6e240b74a5775286fa81a84b456feeb", "Gateway": "172.17.0.1", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "MacAddress": "02:42:ac:11:00:02", "Networks": { "bridge": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "00940e41662d06586b84b480eb93f1cabb6f4de2e34688b4c119cacc72215bf4", "EndpointID": "189c1570eca54bcf01ea7309a93a7ec4a6e240b74a5775286fa81a84b456feeb", "Gateway": "172.17.0.1", "IPAddress": "172.17.0.2", "IPPrefixLen": 16, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "02:42:ac:11:00:02", "DriverOpts": null } } } } ]
2
Answers
Since the default route of the docker bridge network wasnt listed
I typed in Windows
route add 172.17.0.0 mask 255.255.0.0 172.17.0.1
After that i could visit my angular site, which is kinda weird.
So i'm posting it as an answer as it works.
Though i am not sure why adding that 172 route allows me access to http://127.0.0.1:4400/login
Which is on 127.0.0.1
Maybe docker is unable to alter the routing tables when it starts up not sure i think its a bug. I cannot clearly explain why this works (routing commands are a bit of a mystery to me) , not sure if I should post it as an answer therefore, on the other hand i hope it helps others
after it my routing table looked like
It appears that you’ve taken thorough steps to diagnose the issue of accessing your Angular test environment in a Docker container from Windows 11 with WSL2. Given that the container is running, the port is listening, and you can curl from a Linux console, the problem might relate to Windows network settings. Double-check Windows Firewall, ensure WSL2 network isn’t isolated, verify network profile is "Private," temporarily disable proxies or VPNs, and review security software impact. Validate WSL2’s network setup, use the correct IP address for access, and ensure DNS resolution functions correctly. Execute these steps methodically to uncover the underlying connection problem and find a suitable solution.