'My dockerized project's expressjs server does not (randomly) send response to the client

I would be glad somebody helps me with this issue.

Actually my server express is randomly not able to send response to my react client app. Here is morgan logs :

GET /api/comments?withUsers=true - - ms - -

GET /api/categories - - ms - -

POST /api/posts - - ms - -

GET /api/posts - - ms - -

Both of my server and client side apps are running in different docker containers. Here is my docker-compose file :

version: '3'
services:
  blog:
    container_name: blog
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      - postgres
    environment:
      NODE_ENV: development
      PORT: 4000
    ports:
      - '4000:4000'
    volumes:
      - .:/usr/src/app
  client:
    stdin_open: true
    environment:
      - CHOKIDAR_USEPOLLING=true
    build:
      dockerfile: Dockerfile
      context: ./views
    ports:
      - '3000:3000'
    volumes:
      - ./views:/usr/src/app/views
  postgres:
    container_name: postgresql
    image: postgres:latest
    ports:
      - '5432:5432'
    volumes:
      - db-data:/var/lib/postgresql/data
      - ./sql_tables/tables.sql:/docker-entrypoint-initdb.d/dbinit.sql
    restart: always
    environment:
      POSTGRES_USER: db_user_is_her
      POSTGRES_PASSWORD: db_password_is_her
      POSTGRES_DB: blog
  pgadmin:
    container_name: pgadmin
    image: dpage/pgadmin4:latest
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: pgadmin_user_email_is_her
      PGADMIN_DEFAULT_PASSWORD: pgadmin_password_is_her
      PGADMIN_LISTEN_PORT: 80
    ports:
      - '8080:80'
    volumes:
      - pgadmin-data:/var/lib/pgadmin
    depends_on:
      - postgres
volumes:
  db-data:
  pgadmin-data:
  app:

Thank you for your help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source