ufoscout/docker-compose-wait

Everything's fine, but not loaded

Robin-Sch opened this issue · 1 comments

version: '3.8'

services:
  postgres:
    restart: always
    image: postgres:13.1
    container_name: postgres
    volumes:
      - ./postgres:/var/lib/postgresql/data
    ports:
      - 5432:5432
    environment:
      POSTGRES_DB: data
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      PGDATA: /var/lib/postgresql/data/

  mongodb:
    image: mongo:4.4
    container_name: mongodb
    volumes:
      - ./mongodb:/data/db
    ports:
      - 27017:27017
    environment: 
      - MONGO_INITDB_DATABASE=data
      - MONGO_INITDB_ROOT_USERNAME=user
      - MONGO_INITDB_ROOT_PASSWORD=pass

  redis:
    image: redis:6.2-rc
    container_name: redis
    ports:
      - 6379:6379

  bot:
    build: .
    volumes:
      - ".:/bot"
    container_name: bot
    ports:
      - 5000:5000
    depends_on:
      - postgres
      - mongodb
      - redis
    environment: 
      WAIT_HOSTS: postgres:5432, mongodb:27017, redis:6379
      ```
      

docker-compose-wait - Everything's fine, the application can now start!
UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:5432

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379

I need to use the service name instead of localhost when connecting