Interview Prep/Networking/Containers, Kubernetes, IPv6 and packet captures

`docker run -p 8080:80 myapp` starts fine, but `curl localhost:8080` returns `Connection reset by peer`.

BeginnerTroubleshootingContainers, Kubernetes, IPv6 and packet captures
Answer

Likely causes → Docker's port mapping accepts the connection, but inside the container nothing listens on 0.0.0.0:80: the app listens on 127.0.0.1 (only reachable from inside the container) or on a different port (e.g. 3000).

Diagnose →

docker exec myapp ss -ltn      # or: docker exec myapp netstat -ltn
docker logs myapp | grep -i listen
docker port myapp

Fix → Bind the app to 0.0.0.0 (Flask --host=0.0.0.0, Vite --host, Rails -b 0.0.0.0) and map the right container port (-p 8080:3000).

Prevent → EXPOSE the correct port in the Dockerfile and add a HEALTHCHECK that hits it.

All Networking questions Roadmap: Networking for DevOps

More on Containers, Kubernetes, IPv6 and packet captures