Error docker aws nginx * connect() failed

  Kiến thức lập trình

I use aws EC2 instance and could not run my django project.
Docker-compose.yaml

version: '3.7'
services:
  api:
    env_file: .env.dev
    image: ${ECR_REPOSITORY_URI}:api-${IMAGE_TAG}
    restart: unless-stopped
    command: ./docker/api/start
    volumes:
      - static_volume:/app/staticfiles
    logging:
      options:
        max-size: "10m"
        max-file: "3"
  nginx:
    image: ${ECR_REPOSITORY_URI}:nginx-${IMAGE_TAG}
    restart: always
    ports:
      - "80:80"
    depends_on:
      - api
    volumes:
      - static_volume:/usr/share/nginx/html/static
    logging:
      options:
        max-size: "10m"
        max-file: "3"
volumes:
  static_volume:

When I run it, first I’ve got warning messages like:

importlib.import_module(self.SETTINGS_MODULE)

And a lot of connection errors:

nginx_1  | [error] 28#28: *199 connect() failed (111: Connection refused) while connecting to upstream, client: <my host>, server: , request: "GET /admin HTTP/1.1", upstream: "http://172.18.0.2:8888/admin", host: "<my host>"

I’m desperate because I can’t get the project up for a few days. Any ideas to fix it?

LEAVE A COMMENT