Bohee Park
Bohee Park

Reputation: 43

docker-compose.yml invalid type

docker-compose.yml

version: '2.0'
services:
  asdf-db:
    container_name: asdf-db
    build: ./asdf/db
    ports:
      - 5435:5432 # expose ports - HOST:CONTAINER
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    healthcheck:
      test: exit 0

  asdf-service:
    container_name: asdf-service
    build: ./
    volumes:
      - '.:/usr/src/asdf'
    ports:
      - 5001:5000 # expose ports - HOST:CONTAINER
    environment:
      - APP_SETTINGS=asdf.config.DevelopmentConfig
      - DATABASE_URL=postgres://postgres:postgres@asdf-db:5432/asdf_dev
      - DATABASE_TEST_URL=postgres://postgres:postgres@asdf-db:5432/asdf_test
    depends_on:
      asdf-db:
        condition: service_healthy
      links:
        - asdf-db

when i run docker-compose up -d i get the following error message:

ERROR: The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for services.asdf-db: 'healthcheck'
services.asdf-service.depends_on contains an invalid type, it should be an array

I've tried switching the version to 2.1 and then i get the following error message:

ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.asdf-service.depends_on.links contains ["asdf-db"], which is an invalid type, it should be an object

How do I change asdf-db to an object?

Upvotes: 2

Views: 9927

Answers (1)

manojlds
manojlds

Reputation: 301147

Healthcheck was added in 2.1 so you need at least that version.

In 2.1 version, you have links within depends_on, whereas it should be in the same level.

Upvotes: 3

Related Questions