Running Neo4j 3.x on Docker

Neo4j is the world’s leading graph database. Fortunately, Neo Technology publishes official Neo4j Docker images which makes it very easy to get started. Once you have Docker running, simply use the the following command to start running Neo4j in a new container (adjust Neo4j version as necessary):

The -p (or --publish) options above binds the exposed ports 7474 and 7687 in the Docker container to the same ports on the local machine. The -v (or --volume) options mount the local $HOME/neo4j/data directory as the /data directory in the Docker container, as well as mounts the local $HOME/neo4j/logs directory as the /logs directory in the Docker container. The actual Neo4j databases and logs are stored in these directories.

The directories mounted with the -v option will remain on the local filesystem even after the container is stopped or deleted. This means that future containers can use this same data/database. This also means that if you want to create a new container with a new database, you must change the locations of these local directories in the run command.

It is also common to load data from files into your Neo4j database. For this to work these files must be available in your Docker container. Your Docker container will by default try to load (when using the LOAD CSV command) data from within the container at /var/lib/neo4j/import. Mounting a local directory as /var/lib/neo4j/import can make importing data much convenient. For example:

Once your container has started you should be able to interact with Neo4j through the web based UI in a browser at http://localhost:7474.

One thought on “Running Neo4j 3.x on Docker”

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">