I'm trying to host a Linux Mint container that starts a simple Angular server and listens on port 4200. I'm in a very tight environment, with no admin authority on a Windows machine. Running
wget localhost:4200
gives me an index.html file. The contents don't matter, so long as it's able to reach the Angular server (ok, the Angular code hosted on a NodeJS server for those that are pendantic). So, it works in the container.
The port is remapped on the host to port 80.
docker ps -a --format "table {{.ID}}\t{{.Ports}}"
CONTAINER ID PORTS
44619004abe5 127.0.0.1:80->4200/tcp
On the host, Windows netstat reports (irrelevant items omitted):
Proto Local Address Foreign Address State
TCP 127.0.0.1:80 0.0.0.0:0 LISTENING
So for some reason, Docker claims it's routing port 80 into the container's port 4200 yet Windows redirects things to whatever port 0 is.
Trying wget on a known bad port to see the error:
>wget localhost:4299
--2022-05-13 19:32:58-- http://localhost:4299/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:4299... failed: Bad file descriptor.
Trying wget on what should be a good port:
wget http://localhost:80
--2022-05-13 19:34:22-- http://localhost/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... failed: Bad file descriptor.
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... No data received.
docker inspect 44619
"NetworkSettings": {
"Bridge": "",
"SandboxID": "e9505e8ca350eb07fdefd082ea4530885fc602539004b4ca5a6f552e876940e9",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"4200/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "80"
}
]
},
"SandboxKey": "/var/run/docker/netns/e9505e8ca350",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"docker-files_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"geneticist_app",
"44619004abe5"
],
"NetworkID": "302510faf209d6eae4da6d0c5951b63f7821d521707d6d2f9ecca5e7dbda4330",
"EndpointID": "e761a8da5c6d88d9f86bb05bc3c794a92dbe37e5d62bc11c5440111be5fa3c0e",
"Gateway": "172.23.0.1",
"IPAddress": "172.23.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:17:00:02",
"DriverOpts": null
}
}
}