You can use the official Docker Image of Cassandra at https://hub.docker.com/_/cassandra to install it using Docker Compose.
The contents of my Docker Compose file are as follows:
1 2 3 4 5 6 7 8 9 10 11 |
services: cassandra: image: cassandra volumes: - ./cassandra_data:/var/lib/cassandra ports: - 7001:7000 networks: huongdanjava: driver: bridge |
The directory containing Cassandra data inside the container is /var/lib/cassandra, you should mount it outside like me to be able to work with it easily!
The result when I run the command “docker compose up” in the directory containing the file with the above content is as follows: