127.0.0.1 vs 0.0.0.0
An app inside a container listens on 127.0.0.1:8080. The container is started with -p 8080:8080, but requests from the host fail. Why?
127.0.0.1:8080
-p 8080:8080
Choose one answer
Docker reserves port 8080 for its own API, so the mapping silently goes to the daemon.
The app listens only on loopback; it must listen on 0.0.0.0.
0.0.0.0
The container also needs EXPOSE 8080, or Docker drops forwarded packets.
EXPOSE 8080
-p publishes the port only for UDP unless you write 8080:8080/tcp.
-p
8080:8080/tcp