Deployment of Neo4j Docker container with APOC and Graph Algorithms plugins

Mai Ngoc Kien
May 11, 2020 · 3 min read

Recently, I have learnt to use a graph database called Neo4j. And I do not want to install a lot of software on the computer. Hence, Docker image is a good option.

Neo4j docker image provides an awesome graph database with convenient web UI. However, it does not include plugins which support additional library (such as APOC, Graph Algorithms). I need to do some manual set up before being able to deploy the container with plugins.

I do not know the name of the flower T.T, and my favorite super market is over there.

Neo4j plugins

APOC stands for Awesome Procedures on Cypher, a standard utility library for common procedures and functions. This allowed developers across platforms and industries to use a standard library for common procedures and only write their own functionality for business logic and use-case-specific needs.

Graph algorithms provide one of the most potent approaches to analyzing connected data because their mathematical calculations are specifically built to operate on relationships. They describe steps to be taken to process a graph to discover its general qualities or specific quantities.

Note: The Graph Algorithms Library has been deprecated by the Graph Data Science Library (GDS).

Set up directories for volumes

I need to create some directories under the work directory for Docker volumes. Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.

$ mkdir data
$ mkdir logs
$ mkdir conf
$ mkdir plugins

Next, I need to generate the initial config file, I can dump it from the container

$ docker run --rm --volume=$(pwd)/conf:/conf neo4j:3.5.3 dump-config

which will download the configuration file to conf directory under the current host directory.

Download the plugin

In order to use plugins, find and download jar file of the plugins released on their websites, and store it in the plugins directory.

Graph Algorithm:


Edit the configuration file

Modify neo4j.conf by adding these line:*,apoc.**,apoc.*

Deploy the Neo4j container

Run the container, now using folder under working directory.

docker run -d \
--publish=7474:7474 \
--publish=7687:7687 \
--volume=$(pwd)/data:/data \
--volume=$(pwd)/logs:/logs \
--volume=$(pwd)/conf:/conf \
--volume=$(pwd)/plugins:/plugins \
--env=NEO4J_AUTH=none \
--name my_neo4j neo4j:3.2.3

The container:

  • Run as daemon
  • Publish 2 ports: 7474, 7687
  • Data is stored in data directory
  • Log is written to logs directory
  • Config is used from conf directory
  • Plugins are used in plugins directory
  • No authentication is required (we could set/require it by using --env NEO4J_AUTH=neo4j/<password> instead)

Confirm deployment

Check the status of the container by command:

$ docker ps

If the container is running, we can access to the Neo4j Browser UI at the address http://localhost:7474 and check the installation of the plugins by the Cypher command:

CALL algo.list();
CALL apoc.index.list();

If you prefer Python, py2neo module provides a way to connect to the database via this code:

from py2neo import Graph
graph = Graph("bolt://localhost:7474", auth=("neo4j_username", "password"))


The Startup

Get smarter at building your thing. Join The Startup’s +792K followers.

Sign up for Top 10 Stories

By The Startup

Get smarter at building your thing. Subscribe to receive The Startup's top 10 most read stories — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Mai Ngoc Kien

Written by

I am not a morning person

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +792K followers.

Mai Ngoc Kien

Written by

I am not a morning person

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +792K followers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store