Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Ventura 13.5.2 blocking running containers on the browser #5486

Open
wanjiru-njuguna opened this issue Sep 27, 2024 · 1 comment
Open

Comments

@wanjiru-njuguna
Copy link

wanjiru-njuguna commented Sep 27, 2024

Description

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.

Reproduce

docker compose up -d runs the containers all fine. The container logs show no errors. 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.

Expected behavior

docker compose up -d should let me access the app successfully at http://0.0.0.0:8000/

docker version

4.34.2

docker info

Container rhs_soccer_local_redis         Started                        0.2s 
 ✔ Container rhs_soccer_local_mailpit       Started                        0.2s 
 ✔ Container rhs_soccer_local_postgres      Healthy                        5.7s 
 ✔ Container rhs_soccer_local_celeryworker  Started                        0.3s 
 ✔ Container rhs_soccer_local_celerybeat    Started                        0.3s 
 ✔ Container rhs_soccer_local_flower        Started                        5.8s 
 ✔ Container rhs_soccer_local_django        Started

Additional Info

also tried to enter the container using curl and I am getting " (52) Empty reply from server . Here is my docker compose file .

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](http://docker.io/axllent/mailpit:latest)
container_name: rhs_soccer_local_mailpit
ports:
- “8025:8025”

redis:
image: [docker.io/redis:6](http://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.

@mahinops
Copy link

mahinops commented Oct 2, 2024

@wanjiru-njuguna , seems like there might have a couple of issues in the dokcer-compose configurations. I am trying to give some suggestions that might help_

  • The ports you specified use curly quotes (‘8000:8000’) instead of straight quotes ("8000:8000"). Docker Compose requires standard double (") or single (') quotes for port mappings.
  • Ensure that your ALLOWED_HOSTS setting in the Django settings.py file includes localhost and 0.0.0.0.
ALLOWED_HOSTS = ['localhost', '127.0.0.1', '0.0.0.0']
  • As the containers are running fine, you can check the container logs which might indicate why it is not responding using this command, docker logs rhs_soccer_local_django.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants