Neo4j Graph Database
Neo4j graph database with web browser interface.
Overview
Neo4j is a native graph database that revolutionizes how applications handle connected data by storing information as nodes and relationships rather than traditional tables. Originally developed in 2007 by Neo Technology, Neo4j uses its proprietary Cypher query language to traverse complex relationship patterns with exceptional performance, making queries that would require expensive JOINs in relational databases execute in milliseconds. The database combines ACID compliance with graph-native storage, allowing applications to model real-world connections naturally while maintaining data integrity.
This Docker configuration deploys Neo4j with the APOC (Awesome Procedures on Cypher) plugin pre-installed, providing extended functionality for data integration, graph algorithms, and utility procedures. The setup exposes both the HTTP interface for browser-based interaction and the high-performance Bolt protocol for application connectivity. Memory allocation is configurable through environment variables to optimize performance based on dataset size and query complexity.
Developers building recommendation systems, fraud detection platforms, or knowledge management applications will find this stack particularly valuable. The inclusion of APOC procedures enables advanced data manipulation and analysis capabilities that extend Neo4j's core functionality, while the containerized deployment ensures consistent behavior across different environments. Organizations dealing with highly connected data - from social networks to supply chain management - can leverage Neo4j's relationship-first approach to uncover insights that traditional databases struggle to reveal.
Key Features
- Native graph storage engine optimized for relationship traversal
- Cypher declarative query language for intuitive graph pattern matching
- APOC plugin providing 450+ procedures for data integration and analysis
- Neo4j Browser interface for visual query development and result exploration
- High-performance Bolt protocol for low-latency application connectivity
- ACID transaction support ensuring data consistency in concurrent operations
- Configurable JVM heap allocation for workload-specific performance tuning
- Built-in graph algorithms library for centrality, community detection, and pathfinding
Common Use Cases
- 1Social network platforms analyzing user connections and content recommendations
- 2Financial institutions detecting fraud through transaction relationship analysis
- 3E-commerce sites building real-time product recommendation engines
- 4Enterprise knowledge graphs connecting disparate data sources and systems
- 5Identity and access management systems modeling complex permission hierarchies
- 6Supply chain optimization tracking product flows and vendor relationships
- 7Bioinformatics research mapping protein interactions and genetic pathways
Prerequisites
- Minimum 1GB RAM available for Neo4j container (4GB+ recommended for production)
- Ports 7474 (HTTP) and 7687 (Bolt) available on the host system
- Docker Engine 20.10+ and Docker Compose V2 for optimal compatibility
- Basic understanding of graph database concepts (nodes, relationships, properties)
- Familiarity with Cypher query language syntax for effective database interaction
- At least 10GB available disk space for database storage and transaction logs
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 neo4j: 3 image: neo4j:latest4 container_name: neo4j5 restart: unless-stopped6 ports: 7 - "${HTTP_PORT:-7474}:7474"8 - "${BOLT_PORT:-7687}:7687"9 environment: 10 - NEO4J_AUTH=${NEO4J_USER:-neo4j}/${NEO4J_PASSWORD:-password}11 - NEO4J_PLUGINS=["apoc"]12 - NEO4J_dbms_memory_heap_initial__size=${HEAP_INIT:-512m}13 - NEO4J_dbms_memory_heap_max__size=${HEAP_MAX:-1G}14 volumes: 15 - neo4j_data:/data16 - neo4j_logs:/logs17 - neo4j_plugins:/plugins18 networks: 19 - neo4j-network2021volumes: 22 neo4j_data: 23 neo4j_logs: 24 neo4j_plugins: 2526networks: 27 neo4j-network: 28 driver: bridge.env Template
.env
1# Neo4j2HTTP_PORT=74743BOLT_PORT=76874NEO4J_USER=neo4j5NEO4J_PASSWORD=password6HEAP_INIT=512m7HEAP_MAX=1GUsage Notes
- 1Browser at http://localhost:7474
- 2Bolt protocol at localhost:7687
- 3Login with configured credentials
- 4APOC plugin included
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 neo4j:5 image: neo4j:latest6 container_name: neo4j7 restart: unless-stopped8 ports:9 - "${HTTP_PORT:-7474}:7474"10 - "${BOLT_PORT:-7687}:7687"11 environment:12 - NEO4J_AUTH=${NEO4J_USER:-neo4j}/${NEO4J_PASSWORD:-password}13 - NEO4J_PLUGINS=["apoc"]14 - NEO4J_dbms_memory_heap_initial__size=${HEAP_INIT:-512m}15 - NEO4J_dbms_memory_heap_max__size=${HEAP_MAX:-1G}16 volumes:17 - neo4j_data:/data18 - neo4j_logs:/logs19 - neo4j_plugins:/plugins20 networks:21 - neo4j-network2223volumes:24 neo4j_data:25 neo4j_logs:26 neo4j_plugins:2728networks:29 neo4j-network:30 driver: bridge31EOF3233# 2. Create the .env file34cat > .env << 'EOF'35# Neo4j36HTTP_PORT=747437BOLT_PORT=768738NEO4J_USER=neo4j39NEO4J_PASSWORD=password40HEAP_INIT=512m41HEAP_MAX=1G42EOF4344# 3. Start the services45docker compose up -d4647# 4. View logs48docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/neo4j-graph-database/run | bashTroubleshooting
- Neo4j fails to start with 'Cannot allocate memory' error: Reduce NEO4J_dbms_memory_heap_max__size value or increase available system memory
- Browser shows 'ServiceUnavailable' when connecting: Check that Bolt port 7687 is accessible and Neo4j container has finished initialization
- APOC procedures not available in queries: Verify NEO4J_PLUGINS environment variable includes 'apoc' and container has restarted after configuration change
- Authentication fails with default credentials: Ensure NEO4J_AUTH format follows 'username/password' pattern and container has been recreated after password change
- High memory usage with OutOfMemoryError: Adjust heap size settings and consider adding swap space or upgrading system RAM
- Slow query performance on large datasets: Enable query logging with NEO4J_dbms_logs_query_enabled=true to identify inefficient Cypher patterns
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download