Docker EXPOSE Shows 8080 but Localhost Still Cannot Reach the App

Use docker port to find the actual host mapping. A Dockerfile EXPOSE entry documents an expected container port. A published port provides the host-side address that your browser or client connects to.

Read the existing mapping without changing the container

Run docker port demo-api 8080/tcp on a container you own. If it returns 127.0.0.1:18080, the local client should use port 18080. If it reports no mapping, the listed container port does not provide a host listener. Also check Docker is connected to your local development context.

Check where the app listens inside the container

If the mapping exists but requests fail, compare the right side of the mapping with the app's configured port and startup logs. In a conventional bridge-network container, a service listening only on its own loopback will not receive traffic forwarded to the container interface. Confirm application readiness and bind address according to the application's documentation.

Verify a local-only development mapping

For an approved disposable dev container, a mapping such as -p 127.0.0.1:18080:8080 expresses a local host endpoint and a separate internal port. Use the expected health path from that same machine and confirm the returned service identity. If the host port is already occupied, use a conflict-free local port and recheck the actual mapping.

Sources

댓글

이 블로그의 인기 게시물

소니 A6000 Wi-Fi 전송 (컴퓨터로 보내기)

SVN 서버 설치 및 웹 접속 설정-Ubuntu 14.04

VirtualBox(VM) 화면 크기 조절