My First Experience with Neo4J - running in Docker

I was looking for a way to visualise/document our network topology in Docker. While I was doing my research, I saw that Neo4J can be used to do this. Neo4J is an open-source graph database. It is mostly used for data science/engineering to model relationships between entities/nodes. I initially thought that this is just useful for business data but looks like it can also be used to document the network as well.

Here is an example which I found from their website

I don't have experience with Neo4J but I gave it a spin. I tried the online sandbox first. The online sandbox is similar to Play With Docker, no installation is required. You can acccess the Neo4J sandbox here.

The online sandbox was a bit slow so I looked for a Docker image for it so I can run it in my laptop. Neo4J has an official docker image in dockerhub.

Running Neo4J was pretty straightforward.

docker run \
    --publish=7474:7474 --publish=7687:7687 \
    --volume=$HOME/neo4j/data:/data \
    --rm -d neo4j


Once the Neo4J container is running, you can access it using this URL http://localhost:7474/browser/


Surprisingly, even with no experience, I was able to create my first database. Syntax was not that difficult(of course for the basic queries!) and the documentation was easy to understand.

Some references which I used:

Since Neo4J was about understanding relationships between entities, to learn it, I thought of modeling my relationships(family and friends) first.

Here is the script I developed, you can just copy and paste this script in the Neo4J browser's query window.

CREATE (melvin:Person { name: 'Melvin'})
CREATE (raye:Person { name: 'Raye'})
CREATE (katherina:Person { name: 'Katherina'})
CREATE (vito:Person { name: 'Vito'})
CREATE (scb:Company { name: 'SCB'})
CREATE (dbs:Company { name: 'DBS'})
CREATE (olx:Company { name: 'OLX'})
CREATE (chai:Company { name: 'CHAI CHIPS'})
CREATE (sg:Country { name: 'Singapore'})
CREATE (ph:Country { name: 'Philippines'})
CREATE (marvin:Person { name: 'Marvin'})
CREATE (jon:Person { name: 'Jon'})
CREATE (joy:Person { name: 'Joy'})
CREATE (jp:Person { name: 'JP'})


Once it is successfully executed, you can visualise the relationships. Here is a zoomed in view of the data I created.

Isn't that awesome? :)

Now that I have some experience with it, I'll see how we can use it for our network diagrams at work.

Melvin Vivas

Melvin Vivas

Father of 2 wonderful kids, loves programming, wannabee gopher, currently working at an international bank. Bloggin' about Golang, Docker, and Kubernetes.

Read More