Cannot establish incoming connections to docker container

I have a Django app running on docker that requires access to the Azure Storage Accounts from it. It runs fine when the Django server runs from the host computer, but, the connection to the Azure Storage Account fails when running from the container.

I guess, somehow Docker is blocking the incoming traffic, as I can perform ping www.google.com.br from the container, but I never get the response back.

I used to work with this very same app from a MacOS laptop with no issues (the app establishes connection to the Azure Service), but it does not works since I changed my development setup to Linux (Linux KDE Neon).

Any ideas on how can I allow docker containers to receive traffic from the internet?

Thanks.

This is the error I see that indicates me that Azure Storage Account connection is not allowed (plus the fact this works from docker containers when I run the same from my MacOs notebook). I think it may be related to the OS, but I'm not sure.

<urllib3.connection.HTTPSConnection object at 0x7f1286429e10>: Failed to establish a new connection: [Errno -3] Try again')>

This is my Docker compose file: the Celery workers are the containers attempting to establish connection with Azure:

`version: '3.8'

services:
  web-server:
    build: ./apps
    ports:
      - 8000:8000
      - 5678:5678
      - 80:80
      - 443:443
    env_file:
      - ./apps/.env
    volumes:
      - .:/home/app
      - local:/home/app/local
    depends_on:
      - redis-server

  selenium-worker:
    image: selenium/standalone-chrome
    ports:
      - 4444:4444
    volumes:
      - local:/home/app/local
    depends_on:
      - web-server
  
  redis-server:
    image: redis:7-alpine
    volumes:
      - local_redis:/home/app/local/redis
    ports:
      - 6379:6379
    command: [
      "sh",
      "-c",
      "redis-server"
    ]

  celery-worker_1:
    build: ./conf/celery-worker
    env_file:
      - ./apps/.env    
    volumes:
      - .:/home/app
      - local:/home/app/local
    depends_on:
      - redis-server
    command: python -m celery -A api.celery worker

  celery-worker_2:
    build: ./conf/celery-worker
    env_file:
      - ./apps/.env    
    volumes:
      - .:/home/app
      - local:/home/app/local
    depends_on:
      - redis-server
    command: python -m celery -A api.celery worker

  celery-worker_3:
    build: ./conf/celery-worker
    env_file:
      - ./apps/.env    
    volumes:
      - .:/home/app
      - local:/home/app/local
    depends_on:
      - redis-server
    command: python -m celery -A api.celery worker

  celery-beat:
    build: ./conf/celery-worker
    env_file:
      - ./apps/.env    
    volumes:
      - .:/home/app
    depends_on:
      - redis-server
    command: python -m celery -A api.celery beat

  celery-flower:
    build: ./conf/celery-flower
    env_file:
      - ./apps/.env
    volumes:
      - .:/home/app
      - local:/home/app/local
    ports:
      - 5555:5555
    depends_on:
      - redis-server
volumes:
  local:
  local_redis:`

Check if iptables is somehow active and blocking traffic but honestly I'm not sure if this is a problem at Docker or to the host computer setting.

Back to Top