Hey everyone, I am pretty new to Docker and I have this issue that I have been dealing with for days. My containers are running fine, but then I can’t access my app from the browser. I get the response.
This page isn’t working
0.0.0.0 didn’t send any data.
ERR_EMPTY_RESPONSE
I have google serached this specific error and below is what I have tried:
I have reset the database, and also done a recent migration.
Some internet articles suggested checking the internet connection, I did that and also reset my network connection. I also tried tethering off of my phone, just to be sure.
I have cleared my cache, cookie and browsing history. I have tried using a different browser too. I also disabled my browser extensions. I have tried to open the server in an incognito browser.
I tried to change the port and also add a health check for the database to make sure it’s healthy before the django app starts. I also added a wait for the database script to ensure the app doesn’t try to connect to the database before it is ready.
I tried to run it on a windows laptop, and everything worked just fine. Also, my firewall is off on my mac and I am using macOS Ventura 13.5.2.
I also tried to enter the container using curl and I am getting
(52) Empty reply from server
Here is my docker compose file
volumes:
rhs_soccer_local_postgres_data: {}
rhs_soccer_local_postgres_data_backups: {}
rhs_soccer_local_redis_data: {}
services:
django: &django
build:
context: .
dockerfile: ./compose/local/django/Dockerfile
image: rhs_soccer_local_django
container_name: rhs_soccer_local_django
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_started
mailpit:
condition: service_started
volumes:
- .:/app:z
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
ports:
- '8000:8000'
command: /start
# restart: unless-stopped
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
image: rhs_soccer_production_postgres
container_name: rhs_soccer_local_postgres
volumes:
- rhs_soccer_local_postgres_data:/var/lib/postgresql/data
- rhs_soccer_local_postgres_data_backups:/backups
env_file:
- ./.envs/.local/.postgres
healthcheck:
test: ["CMD-SHELL", pg_isready -h postgres -p 5432]
interval: 10s
timeout: 10s
retries: 5
start_period: 60s
# ports:
# - "5432:5432"
mailpit:
image: docker.io/axllent/mailpit:latest
container_name: rhs_soccer_local_mailpit
ports:
- "8025:8025"
redis:
image: docker.io/redis:6
container_name: rhs_soccer_local_redis
volumes:
- rhs_soccer_local_redis_data:/data
celeryworker:
<<: *django
image: rhs_soccer_local_celeryworker
container_name: rhs_soccer_local_celeryworker
depends_on:
- postgres
- redis
- mailpit
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
ports: []
command: /start-celeryworker
celerybeat:
<<: *django
image: rhs_soccer_local_celerybeat
container_name: rhs_soccer_local_celerybeat
depends_on:
- postgres
- redis
- mailpit
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
ports: []
command: /start-celerybeat
flower:
<<: *django
image: rhs_soccer_local_flower
container_name: rhs_soccer_local_flower
ports:
- '5555:5555'
command: /start-flower
Any help will be highly appreciated and also, if more information is needed I am more than happy to provide that.