Categories
Data Engineering Docker Neo4j

Neo4j Spatial Docker

Docker Hub

Starting from Neo4j 4.x, the Neo4j Spatial plugin is incompatible and it will fail to start the database. So, I have a created an Docker image that creates a Neo4j 3.5.25 image along with all the plugins that are required for Spatial queries.

Docker pull command

docker pull dominicvivek06/neo4j_spatial

docker-compose.yml

version: '3'

services:
  neo4j:
    image: dominicvivek06/neo4j_spatial
    hostname: neo4j_35_spatial
    container_name: neo4j_35_spatial
    volumes:
      - ./neo4j/data:/var/lib/neo4j/data
      - ./neo4j/import:/var/lib/neo4j/import
    environment:
      - NEO4J_dbms_connectors_default__listen__address=0.0.0.0
      - NEO4J_metrics_enabled=false 
      - NEO4J_dbms_memory_pagecache_size=1G
      - NEO4J_dbms.memory.heap.initial_size=2G
      - NEO4J_dbms_memory_heap_max__size=4G
      - NEO4J_dbms_directories_import=/var/lib/neo4j/import
      - NEO4J_apoc_spatial_geocode_provider=osm
      - NEO4J_apoc_spatial_geocode_osm_throttle=5000
      - NEO4J_dbms_security_procedures_unrestricted=gds.*,apoc.*,spatial.*
      - NEO4J_dbms_security_procedures_whitelist=gds.*,apoc.*,spatial.*
    ports:
      - "7474:7474"
      - "7687:7687"
      - "7473:7473"

Dockerfile

FROM alpine:latest
WORKDIR /tmp
ADD https://s3-eu-west-1.amazonaws.com/com.neo4j.graphalgorithms.dist/graph-data-science/neo4j-graph-data-science-1.1.6-standalone.zip /tmp
RUN unzip neo4j-graph-data-science-1.1.6-standalone.zip


FROM neo4j:3.5-enterprise
ENV NEO4J_ACCEPT_LICENSE_AGREEMENT=yes \
    NEO4J_HOME="/var/lib/neo4j"
    
ADD https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.13/apoc-3.5.0.13-all.jar "${NEO4J_HOME}"/plugins
ADD https://github.com/neo4j-contrib/spatial/releases/download/0.26.2-neo4j-3.5.2/neo4j-spatial-0.26.2-neo4j-3.5.2-server-plugin.jar "${NEO4J_HOME}"/plugins
COPY --from=0 /tmp/*.jar "${NEO4J_HOME}"/plugins

Anyone can download the files from my github.

Note – The above docker image assumes you have a valid Neo4j License for production. If not, please, contact Neo4j.

 199 total views,  2 views today