Skip to content

Instantly share code, notes, and snippets.

@xmlking
Last active March 24, 2023 01:12
Show Gist options
  • Save xmlking/01c38854cf4b3a8441c9ce62035b37aa to your computer and use it in GitHub Desktop.
Save xmlking/01c38854cf4b3a8441c9ce62035b37aa to your computer and use it in GitHub Desktop.
cassandra healthcheck and dependency for docker compose
version: '2.1'
services:
cassandra:
image: cassandra:latest
networks:
- reactive-network
volumes:
- cassandra_data:/var/lib/cassandra
# - ${PWD}/data/cassandra/data:/var/lib/cassandra
healthcheck:
test: ["CMD-SHELL", "[ $$(nodetool statusgossip) = running ]"]
interval: 30s
timeout: 10s
retries: 5
capi:
image: sumo/cassandra-data-service:0.1.0-SNAPSHOT
ports:
- 8081:8080
environment:
- SPRING_PROFILES_ACTIVE=docker
networks:
- reactive-network
links:
- cassandra
depends_on:
cassandra:
condition: service_healthy
networks:
reactive-network:
driver: bridge
volumes:
cassandra_data:
driver: local
@pratapagiri
Copy link

Thanks for information. We are using docker-compose version 3, how to modify this for docker-compose version 3?

@Boiarshinov
Copy link

@pratapagiri There is no condition property in docker-compose version 3 so there is no way to migrate this configuration to v.3.
But you can use compose schema which have features from v.2 and v.3 both.

Here is a discussion about that problem in SO: https://stackoverflow.com/questions/47710767/what-is-the-alternative-to-condition-form-of-depends-on-in-docker-compose-versio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment