version: '3' services: # Configuration for the seed node DC1N1 # The name could stand for datacenter 1, node 1 DC1N1: image: cassandra:3.10 command: bash -c 'if [ -z "$$(ls -A /var/lib/cassandra/)" ] ; then sleep 0; fi && /docker-entrypoint.sh cassandra -f' # Network for communication between nodes networks: - dc1ring # Mapped the volume to a local directory. volumes: - ./n1data:/var/lib/cassandra # Environment variable for the Cassandra configuration. # CASSANDRA_CLUSTER_NAME must be identical on all nodes. environment: - CASSANDRA_CLUSTER_NAME=Test Cluster - CASSANDRA_SEEDS=DC1N1 # Expose ports for cluster communication expose: # Intra-node communication - 7000 # TLS intra-node communication - 7001 # JMX - 7199 # CQL - 9042 # Thrift service - 9160 # recommended Cassandra Ulimit settings ulimits: memlock: -1 nproc: 32768 nofile: 100000 DC1N2: image: cassandra:3.10 command: bash -c 'if [ -z "$$(ls -A /var/lib/cassandra/)" ] ; then sleep 60; fi && /docker-entrypoint.sh cassandra -f' networks: - dc1ring volumes: - ./n2data:/var/lib/cassandra environment: - CASSANDRA_CLUSTER_NAME=Test Cluster - CASSANDRA_SEEDS=DC1N1 depends_on: - DC1N1 expose: - 7000 - 7001 - 7199 - 9042 - 9160 ulimits: memlock: -1 nproc: 32768 nofile: 100000 DC1N3: image: cassandra:3.10 command: bash -c 'if [ -z "$$(ls -A /var/lib/cassandra/)" ] ; then sleep 120; fi && /docker-entrypoint.sh cassandra -f' networks: - dc1ring volumes: - ./n3data:/var/lib/cassandra environment: - CASSANDRA_CLUSTER_NAME=Test Cluster - CASSANDRA_SEEDS=DC1N1 depends_on: - DC1N1 expose: - 7000 - 7001 - 7199 - 9042 - 9160 ulimits: memlock: -1 nproc: 32768 nofile: 100000 # A web-based GUI for managing containers. portainer: image: portainer/portainer networks: - dc1ring volumes: - /var/run/docker.sock:/var/run/docker.sock - ./portainer-data:/data # Access to the web interface from the host via # http://localhost:10001 ports: - "10001:9000" networks: dc1ring: