Course

Running Neo4j in Docker

Run Neo4j in Docker, then scale up to a fault-tolerant cluster

55 minutes7 lessons across 1 module
About this lab

In this 55-minute lab, you will learn

Running Neo4j on your own infrastructure starts with a single container and grows into a cluster that keeps serving traffic when a machine fails. Both rely on the same building blocks: an image, a set of ports, and a handful of configuration settings.

In this lab, you will run Neo4j in Docker entirely from the command line. You will start one container and connect to it with cypher-shell, then bring up a five-member cluster of three primaries and two secondaries. You will inspect the cluster's topology, see how it reaches agreement, and stop one of its primaries to watch the remaining members elect a new leader and keep accepting writes.

All of the work happens in a GitHub Codespace with Docker already available, so you do not need to install anything locally. By the end, you will understand the image, ports, and environment variables behind a Neo4j deployment, and you will have operated a real cluster through a failure.

  • Running Neo4j in Docker

    Start a container with the right image, ports, authentication, volumes, and the NEO4J_ environment-variable naming convention.

  • How a cluster forms

    Understand primaries, secondaries, Raft consensus, and the discovery, cluster, and Raft ports that let members find each other.

  • Allocating secondaries

    Diagnose secondaries that stay Free, bring them into service with ENABLE SERVER and ALTER DATABASE, and configure the secondaries count so they are allocated from the start.

  • Routing and fault tolerance

    See how reads and writes route across the cluster and watch it survive the loss of a primary.