I am new to Docker and Cassandra and tried their quick start guide to setup Cassandra with Docker locally however meeting following issues.
I can successfully run the command to start Cassandra which is:
docker run --name cassandra cassandra
However when I tried with the command of network:
docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra
it got failed with following errors:
docker: Error response from daemon: Conflict. The container name "/cassandra" is already in use by container "c356c1b25bd096e4c6e0f2afd40a70f375ee34fff332b1b0ba16e14d1f6ab0fc". You have to remove (or rename) that container to be able to reuse that name.
Not quite sure what is the reason here? BTW, I am using the latest version of Docker for Mac as 4.1.1
The step two in the official guide is ambiguous. You don't need and you wont be able to run both commands. Try to run just:
docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra
If you receive the error about the network that does not exist run:
docker network create cassandra
Create the CQL script as the guide tells you and make sure you are in the same path as where you will create the file. Then try to run step 5 (the interactive CQLSH) before running the script. If you receive an error it is probably due to the version that you are using (I had to upgrade to 3.4.5). When you are sure about the version then you can try to run the script with the command in step 4 like this:
docker run --rm --network cassandra -v "$(pwd)/data.cql:/scripts/data.cql" -e CQLSH_HOST=cassandra -e CQLSH_PORT=9042 -e CQLVERSION="3.4.5" nuvo/docker-cqlsh
Replace the CQLVERSION with the correct version and your script should run smoothly. Then finally run again the interactive command line and check that the data is there!
Hope it was helpful!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With