Skip to main content

Annoying Error in Cassandra Quickstart using Docker for Windows

I needed to setup a quick Cassandra environment in Windows today, but I ran into a problem when executing the quick start guide from Cassandra's (excellent) website.

The quick start assumes a working Docker environment. Because this is in Windows, WSL 2 has been configured, and the Docker for Windows binary has been properly installed:

docker pull cassandra:latest 
docker network create cassandra
docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra

From here you can either load data into Cassandra from a file or start a prompt. A prompt is supposed to be opened like this per the documentation:

docker run --rm -it --network cassandra nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.4'
This produces an error:
 

Error messages like this can be a little intimidating. There's a hint, though, in the last line. ValueError and 'invalid literal for int()' indicates that a variable has been miscast. We aren't told what the name of the variable is, but we are told that the variable should have been an integer. From this alone we could tell that there is likely a problem with one of the numbers I provided in the command line statement. I'm just trying to run docker from a Windows command line here, and I didn't feel like dealing with Powershell. This alone is a really good reasons to start throwing different types of quotes on the numeric variables I'm providing to Docker, 9042 and '3.4.4.'.

Helpfully, the last few characters of the error message let me know which one of these two numbers I should be focused on: "''3" is only part of '3.4.4'. Sure enough, replacing the single quotes with double quotes fixed the command:


This is pretty basic stuff, but I wasted more time than I would have liked to on it (its funny this comes a day after I post about bias from authority)