I was doing a little experimenting with graph databases. My goal was to run Neo4j in a docker container, but it wasn’t quite as simple as I expected. I started with a How-To, but it wasn’t enough. This post covers a few things I did to get this working.
In looking at the How-To, I got this command:
docker run
--name testneo4j
-p7474:7474 -p7687:7687
-d
-v $HOME/neo4j/data:/data
-v $HOME/neo4j/logs:/logs
-v $HOME/neo4j/import:/var/lib/neo4j/import
-v $HOME/neo4j/plugins:/plugins
--env NEO4J_AUTH=neo4j/test
neo4j:latest
That’s the basic command I was looking for to run. I tried it, but this doesn’t paste well into a Windows shell. I put the entire thing in a .CMD file to run, making it one long line in the file.
However, when I ran it, I got this:
What’s wrong? Well, $Home is a Linux concept, and it’s looking to map some volumes to folders. The Windows equivalent is %HOMEPATH%. If I check that variable, I see it’s /Users/Steve on my machine.
I created the folders needed for the four volumes, as you can see here:
I tried again, but this didn’t work. I realized, I needed to edit $HOME to %HOMEPATH%. I should have done that immediately.
The next attempt has me seeing this:
Of course that isn’t the right path. I added a “C:” to each volume and things worked.
The final command (For me):
docker run --name testneo4j -p7474:7474 -p7687:7687 -d -v c:%HOMEPATH%neo4jdata:/data -v c:%HOMEPATH%neo4jlogs:/logs -v c:%HOMEPATH%neo4jimport:/var/lib/neo4j/import -v c:%HOMEPATH%neo4jplugins:/plugins --env NEO4J_AUTH=neo4j/test neo4j:latest
If you want to play with Neo4j and don’t want to install things, you can try this. Of course, you still need a query method from an app or a client tool.