Installing Neo4j with Docker

Docker image

This guide installs Neo4j in Docker using the official image.

Run with the Neo4j Docker image

docker run \
  --publish=7474:7474 \
  --publish=7687:7687 \
  --volume=$HOME/neo4j/data:/data \
  --env NEO4J_AUTH=neo4j/password \
  neo4j

After Neo4j starts, open the following URL:

http://localhost:7474/

The web interface appears. Sign in with the neo4j/password credentials configured in the command.

Run with Docker Compose

Create a working directory

Create a working directory in a suitable location.

$ mkdir neo4j
$ cd neo4j

Create the Docker Compose file

Create docker-compose.yml with the following content:

version: '3.1'
services:
  neo4j:
    container_name: neo4j-server
    image: neo4j
    ports:
      - 7474:7474
      - 7687:7687
    volumes:
      - data:/data
    environment:
      NEO4J_AUTH: neo4j/password

volumes:
  data:
    driver: local

Start Docker Compose

Create and start the container:

docker-compose up -d

The -d (--detach) option runs it in detached mode, meaning in the background.

Verify the Docker container

Run the following command to confirm that the Neo4j container is running:

docker ps -a
% docker ps -a
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS                                                      NAMES
bf181e1623d3   neo4j     "tini -g -- /startup…"   19 seconds ago   Up 18 seconds   0.0.0.0:7474->7474/tcp, 7473/tcp, 0.0.0.0:7687->7687/tcp   neo4j-server