Neo4J with Docker Compose

Mon, May 3, 2021 One-minute read

Neo4J is a graph database available for quite a long time. They are actually pioneering this area for years and Neo4J is stable solution in this area. My current project is using Neo4J as the one for database backends so its great time to dig into it. First step is to read some documentation and run this locally in docker, so I can play with.

Useful documentation:

To run current Neo4J version locally in Docker, we can create following docker-compose.yml file:

version: '3.7'
services:
    neo4j:
      image: neo4j:4.2.5
      restart: unless-stopped
      ports:
        - 7474:7474
        - 7687:7687
      volumes:
        - ../tmp/neo4j/conf:/conf
        - ../tmp/neo4j/data:/data
        - ../tmp/neo4j/import:/import
        - ../tmp/neo4j/logs:/logs
        - ../tmp/neo4j/plugins:/plugins
      environment: 
        # Raise memory limits
        - NEO4J_dbms_memory_pagecache_size=1G
        - NEO4J_dbms.memory.heap.initial_size=1G
        - NEO4J_dbms_memory_heap_max__size=1G

To run container we can simply issue following command from console:

docker-compose up

Neo4J should be now running and available with UI using local URL: http://localhost:7474/browser/ .