I have the following compose file:
version: "3"
services:
zookeeper:
image: docker-dev.art.intern/wurstmeister/zookeeper:latest
ports:
- 2181:2181
kafka:
image: docker-dev.art.intern/wurstmeister/kafka:latest
ports:
- 9092:9092
environment:
- KAFKA_LISTENERS=PLAINTEXT://:9092
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092
- KAFKA_ADVERTISED_HOST_NAME=kafka
- KAFKA_ADVERTISED_PORT=9092
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
depends_on:
- zookeeper
app:
build:
context: ./
dockerfile: app/Dockerfile
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4020/actuator/health"]
interval: 30s
timeout: 10s
retries: 5
depends_on:
- kafka
- zookeeper
app-test:
build:
context: ./
dockerfile: test/Dockerfile
depends_on:
app:
condition: service_healthy
As you can see im implementing a healthcheck for the app and I use service_healthy
condition.
But that leads to the error:
The Compose file '.\docker-compose.yml' is invalid because:
services.app-test.depends_on contains an invalid type, it should be an array
Is there a way to fix that issue?
If I change to array sanytax:
...
app-test:
build:
context: ./
dockerfile: test/Dockerfile
depends_on:
- app:
condition: service_healthy
The error changes to:
The Compose file '.\docker-compose.yml' is invalid because:
services.app-test.depends_on contains an invalid type, it should be a string