Introduction
Docker can be downloaded for macOS, Windows, and Linux operating systems from https://www.docker.com/get-started. DockerHub hosts an official Neo4j image that provides a standard, ready-to-run package of Neo4j Community Edition and Enterprise Edition for a variety of versions.
Neo4j editions
Tags are available for both Community Edition and Enterprise Edition.
Version-specific Enterprise Edition tags have an -enterprise
suffix, for example: neo4j:5.8.0-enterprise
.
Community Edition tags have no suffix, for example neo4j:5.8.0
.
The latest Neo4j Enterprise Edition release is available as neo4j:enterprise
.
All supported tags can be found at https://hub.docker.com/_/neo4j/tags.
- Neo4j Enterprise Edition license
-
To use Neo4j Enterprise Edition, you must accept the license agreement by setting the environment variable
NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
.
© Network Engine for Objects in Lund AB. 2022. All Rights Reserved. Use of this Software without a proper commercial license with Neo4j, Inc. or its affiliates is prohibited.
Email inquiries can be sent using the form Contact Neo4j.
More information is also available at: https://neo4j.com/licensing/
Using the Neo4j Docker image
You can start a Neo4j container by using the following command. Note that this Neo4j container will not persist data between restarts and will have the default username/password.
docker run \
--restart always \
--publish=7474:7474 --publish=7687:7687 \
neo4j:5.8.0
You can try out your Neo4j container by opening http://localhost:7474/ (the Neo4j’s Browser interface) in a web browser.
By default, Neo4j requires authentication and prompts you to log in with a username/password of neo4j/neo4j
at the first connection.
You are then prompted to set a new password.
The default minimum password length is 8 characters.
Use the |
The following sections provide more information about how to set an initial password, configure Neo4j to persist data between restarts, and use the Neo4j Docker image.
Using NEO4J_AUTH
to 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:
docker run \
--restart always \
--publish=7474:7474 --publish=7687:7687 \
--env NEO4J_AUTH=neo4j/your_password \
neo4j:5.8.0
With no persistent storage for the databases, However, with persistent storage for the databases, |
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
.
Persisting data using Volumes
The --volume
option maps a local folder to the container, where you can persist data between restarts.
docker run \
--restart always \
--publish=7474:7474 --publish=7687:7687 \
--env NEO4J_AUTH=neo4j/your_password \
--volume=/path/to/your/data:/data \
--volume=/path/to/your/logs:/logs \
neo4j:5.8.0
The folders that you want to mount must exist before starting Docker, otherwise, Neo4j will fail to start due to permissions errors.
If you have mounted a /data volume containing an existing database, setting |
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 \
--user="$(id -u):$(id -g)" \
neo4j:5.8.0
More useful Docker Run options
This table lists some of the options available:
Option | Description | Example |
---|---|---|
|
Name your container to avoid generic ID |
|
|
Specify which container port to expose |
|
|
Detach container to run in background |
|
|
Bind mount a volume |
|
|
Set config as environment variables for the Neo4j database |
|
|
Control whether Neo4j containers start automatically when they exit, or when Docker restarts. |
|
|
Output full list of |
|
The If you no longer want to have the container auto-start on machine boot, you can disable this setting using the flag
For more information on Docker restart policies, see The official Docker documentation. |
Offline installation of Neo4j Docker image
Docker provides the docker save
command for downloading an image into a .tar
package so that it can be used offline, or transferred to a machine without internet access.
This is an example command to save the neo4j:5.8.0
image to a .tar
file:
docker save -o neo4j-5.8.0.tar neo4j:5.8.0
To load a docker image from a .tar
file created by docker save
, use the docker load
command.
For example:
docker load --input neo4j-5.8.0.tar
For complete instructions on using the docker save
and docker load
commands, refer to:
Was this page helpful?