How to run Neo4j container on Docker Desktop

Divindra RamaiDivindra Ramai
2 min read

This guide provides instructions on setting up and connecting to a Neo4j graph database using Docker Desktop and Neo4j Desktop on a Windows machine. It includes detailed steps for installing Docker Desktop, downloading the Neo4j Docker image, configuring the container settings, and establishing a remote connection via Neo4j Desktop to access the database.

Prerequisites:

Install and set up Docker Desktop

  1. Download and Install Docker Desktop for your Windows Machine

  2. Once installed, launch the desktop application and search for the β€œneo4j” docker image from the search bar. Pull the image on your local machine.

    The image will be found under the Images tab on the Docker Desktop application

  3. Run the Image and enter the following Optional Settings for the container.

    • Container Name: Enter any name, e.g., Neo4j.

    • Ports:

      Map container port 7473/tcp to 7473 (or another chosen port)

      Map container port 7474/tcp to 7474

      Map container port 7687/tcp to 7687

    • Volume Mounts:

      All Host Path: C:\Users\<name>\n4j storage
      Destination Container Path: /data
      Destination Container Path: /conf
      Destination Container Path: /logs
      Destination Container Path: /plugins

    • Environment variables: Update the Neo4j password to password or something more secure :). Variable: NEO4J_AUTH, Value: neo4j/password.

At this stage, there should be a running container as shown below.

You can see successful startup messages in the container logs by going to the Container > neo4j > Logs section.

Note the remote interface URL shown for later access.


Connect and access the graph database via Neo4j Desktop

  1. Create a new Project on Neo4j Desktop e.g. Docker

  1. Add a Remote connection

  1. Enter a connection name, such as Neo4j Container, and update the connect URL using the previously specified port, 7687.

  1. Enter the Username and Password set in the container environment variable.

Finally, connect to the Neo4j Database running on the Docker container and notice the Active status.


  1. Open Neo4j Browser under Open > Neo4j Browser.

You are now connected to the Neo4j Database running on the Docker Container !!

Execute Neo4j Cypher query to interact with the graph such as creating a new node on the database.

Alternative access via Web Browser

  1. Connect to the remote interface URL http://localhost:7474 using the previously mentioned username and password and execute the cypher query.

Happy Coding! πŸŽ‰πŸ˜„

Look out for more posts on related Graph Database and Containerization technology.


References:

https://www.docker.com/products/docker-desktop/

https://neo4j.com/download/

0
Subscribe to my newsletter

Read articles from Divindra Ramai directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Divindra Ramai
Divindra Ramai

I am an IT Professional with over 13 years of experience managing technologies and software to support the Caribbean Banking industry. I possess a Bachelor of Science degree in Information Technology and a Master's Degree in Computer Science both from the University of the West Indies, St Augustine. My interest lies in Graph technology, Neural Networks, Containerization Orchestration, and Cloud Technologies.