[Troubleshooting] Docker Containers Are Running but the Service Is Not Accessible

When checking with docker ps, the container status shows Up (Running),
but the service is not accessible from outside (browser, curl) in some cases.

This issue is not about whether the container process is “alive,”
but in most cases is caused by network listening configuration or port mapping settings.


Symptoms (The Phantom Service) #

docker ps 
CONTAINER ID   IMAGE     STATUS         PORTS
abcd1234       my-app    Up 10 minutes  0.0.0.0:8080->8080/tcp

Observed State #

  • The container is running normally (Up)
  • The port appears to be bound correctly

Problem #

When accessing with curl localhost:8080 or a browser:

  • Connection refused
  • Infinite loading

Cause 1: Localhost (127.0.0.1) Binding (Most Common) #

This case accounts for 80–90% of occurrences.

If the application inside the container is listening only on 127.0.0.1,
it is impossible to access it from outside the container (host).
localhost inside a container refers only to the container itself.

How to Check (Inside the Container) #

docker exec -it <container_name> ss -nltp
# or netstat -nltp
LISTEN 0 128 127.0.0.1:8080   <-- confirmed issue (external access impossible)
LISTEN 0 128 0.0.0.0:8080     <-- normal (external access possible)

Note #

With lightweight images such as Alpine or Distroless,
even ss, netstat, or curl may not be available.
In that case, check the application startup logs or
the binding address directly in configuration files such as
application.yml, nginx.conf, etc.

Resolution #

Change the application listening address.

  • Before: 127.0.0.1, localhost
  • After: 0.0.0.0 (or ::)

Cause 2: Port Mismatch #

The port exposed by Docker (-p) does not match the actual port used by the application.

Common Mistake #

docker run -p 8080:8080 my-app

Docker forwards traffic to port 8080 inside the container.
But what if the application is actually listening on port 3000?

Check and Fix #

docker exec -it <container> ss -nltp
LISTEN 0 128 0.0.0.0:3000
# Restart with corrected port mapping
docker run -p 8080:3000 my-app

Cause 3: Works Internally but Not Externally #

If the service is accessible from inside the container
but not from the host or external clients, it is a network issue.

Internal Test #

docker exec -it <container> curl localhost:8080
  • Success → the application is healthy; network/firewall issue
  • Failure → the application itself is unhealthy or hung

Check Points #

  • Host firewall (ufw, firewalld)
  • Cloud security groups (AWS SG, etc.)
  • Whether the service is bound only to a specific private IP

Cause 4: Docker Network Configuration Issues #

When using a custom network (user-defined bridge),
external access may be intentionally restricted by design.

Check #

docker inspect <container> | grep -i network
  • Verify bridge vs user-defined network
  • Confirm whether the container is intended to be externally exposed

Log Patterns That Must Be Checked #

docker logs <container>

Common decisive logs:

  • Listening on 127.0.0.1
    → Cause 1 confirmed
  • Bind failed: Address already in use
    → Port conflict; application did not start
  • No service startup logs at all
    → Initialization hang or crash

Tip #

To identify these situations quickly,
it is recommended to configure HEALTHCHECK in the Dockerfile or docker-compose.
When the service is unreachable, the status will be shown as Up (unhealthy),
making the issue much easier to detect.


Key Summary #

  • Running only indicates that the process is alive; it does not guarantee service availability
  • Check in this order:
    • Listening address (127.0.0.1 vs 0.0.0.0)
    • Port mapping vs actual application port
  • With lightweight images, logs and configuration files are more important than commands

Following this order,
most cases of “Docker is running but not accessible” are resolved within 10 minutes.

🛠 마지막 수정일: 2025.12.23

💡 도움이 필요하신가요?
Zabbix, Kubernetes, 그리고 다양한 오픈소스 인프라 환경에 대한 구축, 운영, 최적화, 장애 분석, 광고 및 협업 제안이 필요하다면 언제든 편하게 연락 주세요.

📧 Contact: jikimy75@gmail.com
💼 Service: 구축 대행 | 성능 튜닝 | 장애 분석 컨설팅

📖 E-BooK [PDF] 전자책 (Gumroad): Zabbix 엔터프라이즈 최적화 핸드북
블로그에서 다룬 Zabbix 관련 글들을 기반으로 실무 중심의 지침서로 재구성했습니다. 운영 환경에서 바로 적용할 수 있는 최적화·트러블슈팅 노하우까지 모두 포함되어 있습니다.


💡 Need Professional Support?
If you need deployment, optimization, or troubleshooting support for Zabbix, Kubernetes, or any other open-source infrastructure in your production environment, or if you are interested in sponsorships, ads, or technical collaboration, feel free to contact me anytime.

📧 Email: jikimy75@gmail.com
💼 Services: Deployment Support | Performance Tuning | Incident Analysis Consulting

📖 PDF eBook (Gumroad): Zabbix Enterprise Optimization Handbook
A single, production-ready PDF that compiles my in-depth Zabbix and Kubernetes monitoring guides.

What are your feelings

Updated on 2025-12-23