Docker Community Forums

Share and learn in the Docker community.

ERROR The Compose file docker-compose is invalid because

I am receiving this error message;

This message appears when running docker-compose.yml, take a look at how it looks!

version: "3.5"
services:
  kwan:
    image: postgres
    container_name: postgres-kwan
    environment:
      - POSTGRES_PASSWORD=root
      - POSTGRES_USER=postgres
      - POSTGRES_DB=POSTGRESQL
    ports:
      - "15432:5432"
    volumes:
      - pgdata-teste:/var/lib/postgresql/data

    healthcheck:
    test: ["CMD-SHELL", "pg_isready -U postgres"]
    interval: 5s
    timeout: 3s
    retries: 5
    networks:
      - postgres-compose-network


networks: 
  postgres-compose-network:
    driver: bridge

Just add 2 spaces:

    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
1 Like

Thank you so much, it worked