beginnerDocker Networking: Bridge, Host, Overlay, DNS & Port Mapping
A container's published port works locally but isn't reachable from another machine on the network
`docker run -p 8080:80 myapp` works via curl localhost:8080 on the host but a separate machine on the same LAN can't connect to host-ip:8080. Diagnose. Expected reasoning: check the port binding (was it bound to 127.0.0.1:8080:80 instead of 0.0.0.0:8080:80, restricting it to loopback only); check the host firewall/security group rules for port 8080; confirm the host's network interface is actually reachable from the other machine independent of Docker.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response