docker-library / cassandra

Docker Official Image packaging for Cassandra
Apache License 2.0
262 stars 282 forks source link

The container start before the cassandra db is up #282

Closed NIKFIORE closed 2 months ago

NIKFIORE commented 2 months ago

I tried to use the healtcheck , and playing with the time variable to find a right tempistic but it didn't work

this is my docker-compose file:

services:
  app:
    build: 
      context: .
      dockerfile: ./Dockerfile
    volumes:
      - .:/app
    container_name: app-container
    depends_on:
      database:
        condition: service_healthy

  database:
    image: cassandra:latest
    ports:
      - 9042:9042
    container_name: cassandra-study-container
    healthcheck:
      test: ["CMD", "cqlsh", "-e", "describe keyspace"]
      interval: 30s
      timeout: 10s
      retries: 5
tianon commented 2 months ago

Sorry, but this isn't going to be something we can give a generic answer to - it's going to be really variable depending on your infrastructure (available resources, etc).