An introduction to how Neo4j runs in a Docker container.

This section includes:

Docker can be downloaded for MacOS, Windows and Linux operating systems here: There is an official Neo4j image on DockerHub that provides a standard, ready-to-run package of Neo4j. From the DockerHub repo, it is possible to run Community Edition or Enterprise Edition with a variety of versions of the database. The Neo4j Docker image, and instructions on how to start using it, can be found here:

1. Neo4j editions

Tags are available for both Community Edition and Enterprise Edition. Version-specific Enterprise Edition tags have an -enterprise suffix, for example: neo4j:4.1.1-enterprise. Community Edition tags have no suffix, for example neo4j:4.1.1. The latest Neo4j Enterprise Edition release is available as neo4j:enterprise.

All supported tags can be found at

1.1. Neo4j Enterprise Edition license

In order to use Neo4j Enterprise Edition you must accept the license agreement.

© Network Engine for Objects in Lund AB. 2018. All Rights Reserved. Use of this Software without a proper commercial license with Neo4j, Inc. or its affiliates is prohibited.

Email inquiries can be directed to:

More information is also available at:

To accept the license agreement set the environment variable NEO4J_ACCEPT_LICENSE_AGREEMENT=yes.

To do this you can use the following docker argument:


2. Using the Neo4j Docker image

A Neo4j container can be started using the following command:

docker run \
    --restart always \
    --publish=7474:7474 --publish=7687:7687 \
    --volume=$HOME/neo4j/data:/data \

However, there are several options with the docker run command. This table lists some of the options available:

Table 1. Options for docker run
Option Description Example


Name your container to avoid generic ID

docker run --name myneo4j neo4j


Specify which container port to expose

docker run -p7687:7687 neo4j


Detach container to run in background

docker run -d neo4j


Bind mount a volume

docker run -v $HOME/neo4j/data:/data neo4j


Set config as environment variables for Neo4j database

docker run --env NEO4J_AUTH=neo4j/test


Control whether Neo4j containers start automatically when they exit, or when Docker restarts.

docker run --restart


Output full list of docker run options

docker run --help

By including --restart always, the Neo4j container (and Neo4j) will be restarted automatically whenever the Docker daemon is restarted.

3. Using NEO4J_AUTH to set an initial password

By default, Neo4j requires authentication and prompts you to login with a username/password of neo4j/neo4j at the first connection. You are then prompted to set a new password. For more information about setting the initial password for Neo4j, see Set an initial password.

When using Neo4j in a Docker container, you can set the initial password for the container directly by specifying the NEO4J_AUTH in your run directive:

--env NEO4J_AUTH=neo4j/your_password

Alternatively, you can disable authentication by specifying NEO4J_AUTH to none:

--env NEO4J_AUTH=none

Please note that there is currently no way to change the initial username from neo4j.

If you have mounted a /data volume containing an existing database, setting NEO4J_AUTH will have no effect. The Neo4j Docker service will start, but to log in you will need a username and password already associated with the database.

4. Running Neo4j as a non-root user

For security reasons, Neo4j runs as the neo4j user inside the container. You can specify which user to run as by invoking docker with the --user argument. For example, the following runs Neo4j as your current user:

docker run \
    --publish=7474:7474 --publish=7687:7687 \
    --volume=$HOME/neo4j/data:/data \
    --volume=$HOME/neo4j/logs:/logs \
    --user="$(id -u):$(id -g)" \
The folders that you want to mount must exist before starting Docker, otherwise Neo4j will fail to start due to permissions errors.