Running Neo4j inside a Docker container is super-simple. In this short tutorial we will create a Docker configuration for Neo4j and create a default Neo4j configuration template for later tweaking.
First, we need a
docker-compose.yml file. Create the file in your project root.
version: "2" services: neo: image: neo4j:3.0 mem_limit: 4096m restart: on_failure ports: - "7474" - "7687" volumes: - ./data:/data - ./conf:/conf
This will create a Docker image with
4Gb of memory, that auto-restarts after a crash. Because we want
to access Neo4j services, we have to expose ports
7474 (Rest API) and
7687 (Bolt protocol).
volumes gives us persistent storage of Neo4j database (
/data) and configuration (
Both directories are currently empty, but we will fix that shortly.
Building the image
docker-compose.yml file all ready, we just execute the following
That’s it. Our custom Docker container image is ready to be launched.
Dumping the default configuration
docker-compose run --rm neo dump-config
This command will spawn a container instance of
neo image, defined in our
file and run
dump-config command inside that instance.
This is a special command, given to us by the folks from Neo4j that copies its configuration files
/conf directory. After running this command you should see new files in your
directory inside your project root on the host.
In the previous step,
dump-config gave us a default template on which we will build upon. Files
neo4j-wrapper.conf contain settings for the Neo4j server and
Java Virtual Machine (JVM).
For now, these default settings will be enough, as the details on this subject are beyond the scope of the tutorial.
You can look up futher information at neo4j.com/docs.
We are now ready to launch an instance of Neo4j server.
Give Neo4j a few seconds to load up then head to