Install Memgraph with Docker

Docker is a containerization platform that packages software and its dependencies into isolated environments called containers. Memgraph provides official Docker images to help you quickly set up the database, tools and analytics.

This page covers:

Quickstart

Run Memgraph MAGE

docker run -p 7687:7687 -p 7444:7444 --name memgraph memgraph/memgraph-mage

This command launches Memgraph MAGE, the main Docker image which includes:

The container maps the following ports for communication and monitoring:

  • 7687: Used by client applications (e.g., Memgraph Lab, mgconsole, drivers) to connect and execute queries on the Memgraph database.
  • 7444: Streams Memgraph logs to Memgraph Lab for real-time monitoring (optional but recommended).

Connect via CLI

The simplest way to execute Cypher queries against Memgraph is through its command-line tool, mgconsole. If you’re running Memgraph in Docker, you can start the CLI with:

docker exec -it memgraph mgconsole

This connects directly to your running Memgraph instance.

For more detailed instructions, visit our CLI documentation.

Connect via Memgraph Lab

If you prefer more visual approach, Memgraph Lab offers a user-friendly UI to interact with your data and run Cypher queries. You have two options:

Option 1: Run Memgraph Lab via Docker

docker run -d -p 3000:3000 --name lab memgraph/lab

Once running, open your browser and go to localhost:3000 to start using Memgraph Lab.

Option 2: Download the app

Alternatively, you can download Memgraph Lab and connect it to your existing Memgraph instance.

For more information, visit our Memgraph Lab documentation.

Available Docker images

All Memgraph Docker images are available at Memgraph’s Docker Hub. There you will find the exact Docker image tags you can use to install Memgraph with.

Core images

ImageIncludes
memgraph/memgraph-mageMemgraph DB + CLI + MAGE library
memgraph/memgraphMemgraph DB + CLI (no graph algorithms)

Use memgraph/memgraph-mage unless you have a reason to use the slim or separate components.

Standalone tools

ImageDescription
memgraph/mgconsoleCLI client to interact with Memgraph
memgraph/labWeb interface for querying and visualization

Using Docker Compose

To manage Memgraph and its tools (e.g. Memgraph Lab) as a single app in a multi-containered setup, use Docker Compose.

Create a docker-compose.yml:

version: "3"
services:
  memgraph:
    image: memgraph/memgraph-mage
    ports:
      - "7687:7687"
      - "7444:7444"
  lab:
    image: memgraph/lab
    ports:
      - "3000:3000"
    environment:
      QUICK_CONNECT_MG_HOST: memgraph

Then run:

docker-compose up

This will launch both Memgraph database and Memgraph Lab.

We provided a basic setup in the example above, but for more details, visit our Docker Compose documentation.

Install from a downloaded image

If you’ve downloaded the Memgraph Docker image directly from the Memgraph download hub, you’ll receive a file named similar to memgraph-3.2.0-docker.tar.gz (the exact file name varies based on the version you’ve downloaded).

To load this image into Docker, do the following:

Load the image into Docker

Use the docker load command to load the image into Docker:

docker load -i memgraph-3.2.0-docker.tar.gz

Run the Memgraph image

After loading the image, you can run it using the docker run command. Here’s an example command to start the Memgraph Docker container:

docker run -p 7687:7687 -p 7444:7444 --name memgraph memgraph/memgraph:3.2.0

Configuration options

Memgraph accepts configuration options via command line. Example:

docker run memgraph/memgraph --bolt-port=7687 --log-level=TRACE

For full configuration settings, refer to the Memgraph Configuration docs.

Advanced: cuGraph Support (Legacy)

cuGraph builds are no longer maintained since Memgraph MAGE v1.3. These instructions are here as a reference for legacy installations.

To run GPU-accelerated graph analytics (if using an older version):

  1. Ensure you have a Pascal+ NVIDIA GPU and required drivers.
  2. Install:
    • Docker CE v19.03+
    • nvidia-container-toolkit

Run Memgraph MAGE + cuGraph (legacy):

docker run --rm --gpus all -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:1.3-cugraph-22.02-cuda-11.5

Troubleshooting

Docker not running?

  • Launch Docker Desktop and wait for it to start.
  • Run: docker ps to verify it’s working.
  • If needed, restart your instance.

Memgraph Lab can’t connect?

Connection issues between Memgraph Lab and Memgraph often depend on your deployment method and operating system. The behavior of the QUICK_CONNECT_MG_HOST environment variable varies by platform:

  • Mac & Windows: Use host.docker.internal to allow Docker containers to communicate with services running on the host machine. Set this as the value of QUICK_CONNECT_MG_HOST when running Memgraph Lab to connect to a host-based Memgraph instance:

    docker run -d -p 3000:3000 -e QUICK_CONNECT_MG_HOST=host.docker.internal --name lab memgraph/lab
  • Linux: You usually don’t need to set QUICK_CONNECT_MG_HOST. It defaults to localhost, which works if Memgraph is running directly on the host.

Additionally, you can specify a custom port using the QUICK_CONNECT_MG_PORT environment variable. For example:

-e QUICK_CONNECT_MG_PORT=7688

This allows Memgraph Lab to connect using a different port if needed.

Connection failure

Let’s say you’ve encountered the following error:

Connection failure: Couldn't connect to 127.0.0.1:7687!

To fix this issue, just replace HOST from the first command with host.docker.internal. To find out more about networking in Docker, take a look at Networking features in Docker Desktop for Windows guide or Mac guide .

Issues with the IP address

While uncommon, some users may face connectivity issues after installing Memgraph via Docker. Instead of running on localhost, the Memgraph container might be assigned a custom IP address. You can identify and use this IP address by following these steps:

Find the container ID

First, list your running Docker containers:

docker ps

You’ll see an output like:

CONTAINER ID    IMAGE       COMMAND                  CREATED
9397623cd87e    memgraph    "/usr/lib/memgraph/m…"   2 seconds ago

Take note of the CONTAINER ID for the Memgraph image — in this case, it’s 9397623cd87e.

Get the container's IP address

Next, retrieve the container’s internal IP address using the ID:

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 9397623cd87e

This IP is the address you’ll use to connect via Memgraph Lab or mgconsole.

Use the IP to connect

Replace HOST in the following command with the IP address you just retrieved:

docker run -it --entrypoint=mgconsole memgraph/memgraph-platform --host HOST

This ensures you’re connecting directly to the Memgraph instance running in Docker.