Install Memgraph with Docker
Docker (opens in a new tab) is a service that uses OS-level virtualization to deliver software in packages that are called containers (opens in a new tab).
Memgraph uses Docker because it is:
- Flexible
- Lightweight
- Portable - you can build locally or deploy to the cloud
- Runs on all platforms - Windows, Linux and macOS
- Deploys in Kubernetes
Memgraph bundles the database along with various analytical tools into distinct
Docker images. If you're new to Memgraph or you're in a developing stage, we
recommend using the memgraph-platform
image. It includes:
- Memgraph - the database that holds your data
- Memgraph Lab - web interface for running queries and visualizing graph data
- mgconsole - command-line interface for running queries
- MAGE - graph algorithms and modules library
Once you're ready to go to production you can choose to use other Docker
images, for example, the
memgraph-mage
Docker image that includes the database and the algorithms, or
run the database only, using the memgraph
image.
Install Memgraph Platform
Install Docker Desktop
Install Docker Desktop (opens in a new tab) by following the instructions available on their site.
Install and run Memgraph
Open a terminal and use the following command:
docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 --name memgraph memgraph/memgraph-platform
After downloading the image, Memgraph will install and if the installation was successful, you should see a message similar to the following:
C:\Users\Vlasta>docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 --name memgraph memgraph/memgraph-platform
2023-08-29 09:02:59,833 INFO Included extra file "/etc/supervisor/programs/lab.conf" during parsing
2023-08-29 09:02:59,834 INFO Included extra file "/etc/supervisor/programs/memgraph.conf" during parsing
2023-08-29 09:02:59,834 INFO Set uid to user 0 succeeded
2023-08-29 09:02:59,842 INFO supervisord started with pid 1
2023-08-29 09:03:00,845 INFO spawned: 'memgraph' with pid 7
2023-08-29 09:03:00,848 INFO spawned: 'lab' with pid 8
You are running Memgraph v2.10.1
To get started with Memgraph, visit https://memgr.ph/start
[2023-08-29 09:03:01.034] [memgraph_log] [warning] Invalid license key string. To use Enterprise features please set it to a valid string using the following query:
SET DATABASE SETTING "enterprise.license" TO "your-license-key"
[2023-08-29 09:03:01.333] [memgraph_log] [warning] No snapshot or WAL file found. For more details, visit https://memgr.ph/durability.
[2023-08-29 09:03:01.333] [memgraph_log] [warning] Replication configuration will NOT be stored. When the server restarts, replication state will be forgotten.
2023-08-29 09:03:02,334 INFO success: memgraph entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-08-29 09:03:02,335 INFO success: lab entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[2023-08-29 09:03:02.803] INFO: [lab] Lab is running at http://localhost:3000 in platform mode
DGL backend not selected or invalid. Assuming PyTorch for now.
<frozen importlib._bootstrap>:228: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility. Expected 56 from C header, got 64 from PyObject
[2023-08-29 09:03:09.257] [memgraph_log] [error] Unable to load module "/usr/lib/memgraph/query_modules/libmgclient.so"; /usr/lib/memgraph/query_modules/libmgclient.so: undefined symbol: mgp_init_module. For more details, visit https://memgr.ph/modules.
[2023-08-29 09:03:09.542] [memgraph_log] [error] Unable to load module "/usr/lib/memgraph/query_modules/example_cpp.so"; /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib/memgraph/query_modules/example_cpp.so). For more details, visit https://memgr.ph/modules.
[2023-08-29 09:03:09.542] [memgraph_log] [warning] Using non-secure Bolt connection (without SSL). For more details, visit https://memgr.ph/ssl.
Memgraph will start listing the logs, and don't worry about the inital errors and warnings as at this point, they are of informative nature.
Connect to the instance
You can connect to the Memgraph instance using the command-line interface mgconsole by running the following command in a new terminal:
docker exec -it memgraph mgconsole
When the mgconsole starts, you can query the database:
C:\Users\Vlasta>docker exec -it memgraph mgconsole
mgconsole 1.3
Connected to 'memgraph://127.0.0.1:7687'
Type :help for shell usage
Quit the shell by typing Ctrl-D(eof) or :quit
memgraph>
You can also connect to Memgraph using the Memgraph Lab web
application available within the
memgraph-platform
Docker image by visiting localhost:3000
.
To start using Memgraph in your application, use one of the client libraries and follow their getting started guide.
Running individual tools from Memgraph Platform image
You can run only the Memgraph database instance from the Memgraph Platform image using the following command:
docker run -p 7687:7687 memgraph/memgraph-platform -c /etc/supervisor/supervisord-memgraph-only.conf
You can run only mgconsole web application from the Memgraph Platform image using the following command in Linux:
docker run -it --entrypoint=mgconsole memgraph/memgraph-platform
You can run only mgconsole web application from the Memgraph Platform image using the following command in Windows and macOS:
docker run -it --entrypoint=mgconsole memgraph/memgraph-platform --host host.docker.internal
You can run only the Memgraph Lab web application from the Memgraph Platform image using the following command:
docker run -p 3000:3000 memgraph/memgraph-platform -c /etc/supervisor/supervisord-lab-only.conf
Stop and start the instance
You can stop the instance with docker stop memgraph
.
You can restart the instance with docker start memgraph
Other available Docker images
All Memgraph Docker images are availble at Memgraph's Docker Hub (opens in a new tab). There you will find the exact Docker image tags you can use to install Memgraph with.
when you're developing or if you're new to Memgraph we recommend using the
memgraph-platform
image. Once you're ready to go to production you can choose
to use the memgraph-mage
Docker image that includes the database and the graph
library, or just run the database using the memgraph
image.
The main repositories are:
memgraph/memgraph-platform
includes Memgraph database, command-line interfacemgconsole
,MAGE
graph algorithms library andMemgraph Lab
web interfacememgraph/memgraph-platform
also includes a version of image without the graph algorithms libraryMAGE
(look for the tag using onlymemgraph
andlab
keywords).
memgraph/memgraph-mage
includes Memgraph database, command-line interfacemgconsole
andMAGE
graph algorithms librarymemgraph/memgraph-mage
+ cuGraph - includes Memgraph database, command-line interfacemgconsole
,MAGE
graph algorithms library and NVIDIA cuGraph GPU-powered graph algorithms
memgraph/memgraph
includes Memgraph database and command-line interfacemgconsole
Install Memgraph using other Docker images
To install Memgraph from any image, you need to adjust the docker run
command
in Step 2.
memgraph/memgraph-mage
+ cuGraph have a specific installation process.
memgraph/memgraph-platform
without MAGE
Install and run the memgraph-platform
image that doesn't include
MAGE using the following command:
docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 --name memgraph memgraph/memgraph-platform:2.10.2-memgraph2.10.1-lab2.8.1
Check the latest versions at Memgraph's Docker Hub (opens in a new tab).
You can connect to the Memgraph instance using the command-line interface mgconsole by running the following command in a new terminal:
docker exec -it memgraph mgconsole
You you can also connect to Memgraph using the Memgraph Lab web
application available within the
memgraph-platform
Docker image by visiting localhost:3000
.
To start using Memgraph in your application, use one of the client libraries and follow their getting started guide.
memgraph/memgraph-mage
Install and run the memgraph-mage
image using the following command:
docker run -p 7687:7687 -p 7444:7444 --name memgraph memgraph/memgraph-mage
You can connect to the Memgraph instance using the command-line interface mgconsole by running the following command in a new terminal:
docker exec -it memgraph mgconsole
You can also connect to Memgraph instance using the Memgraph Platform desktop application, available for download from Memgraph's Download Hub (opens in a new tab).
To start using Memgraph in your application, use one of the client libraries and follow their getting started guide.
memgraph/memgraph-mage
+ cuGraph
Check prerequisites
To be able to run cuGraph analytics, make sure you have compatible infrastructure first. The exact system requirements are available at the NVIDIA RAPIDS site (opens in a new tab), and include an NVIDIA Pascal (or better) GPU and up-to-date CUDA & NVIDIA drivers.
You will also need to install:
- Official NVIDIA driver (opens in a new tab) for your operating system.
- To run on NVIDIA-powered GPUs, RAPIDS requires Docker CE v19.03+ and nvidia-container-toolkit (opens in a new tab).
- Legacy Docker CE v17-18 users requie the nvidia-docker2 package (opens in a new tab).
Install and run Memgraph
Install and run Memgraph using the following command:
docker run --rm --gpus all -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:1.3-cugraph-22.02-cuda-11.5
Check the latest versions of cuGraph Docker images at Memgraph's Docker
Hub (opens in a new tab), by searching the
memgraph/memgraph-mage
repository with the cugraph
keyword.
You can connect to the Memgraph instance using the command-line interface mgconsole by running the following command in a new terminal:
docker exec -it memgraph mgconsole
You can also connect to Memgraph instance using the Memgraph Platform desktop application, available for download from Memgraph's Download Hub (opens in a new tab).
To start using Memgraph in your application, use one of the client libraries and follow their getting started guide.
memgraph/memgraph
Install and run the memgraph
image using the following command:
docker run -p 7687:7687 -p 7444:7444 --name memgraph memgraph/memgraph
You can connect to the Memgraph instance using the command-line interface mgconsole by running the following command in a new terminal:
docker exec -it memgraph mgconsole
You can also connect to Memgraph instance using the Memgraph Platform desktop application, available for download from Memgraph's Download Hub (opens in a new tab).
To start using Memgraph in your application, use one of the client libraries and follow their getting started guide.
Configuration options
To learn about all the configuration options, check out the configuration settings.
When using Docker, you can specify the configuration options in the docker run
command:
docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 -e MEMGRAPH="--log-level=TRACE" memgraph/memgraph-platform
When working with Memgraph Platform, you should pass configuration flags inside of environment variables, while all the other Docker images use regular configuration flags.
For example, you can start the memgraph
image with docker run memgraph/memgraph --bolt-port=7687 --log-level=TRACE
, but you should start the
memgraph-platform
with docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 -e MEMGRAPH="--bolt-port=7687 --log-level=TRACE" memgraph/memgraph-platform
.
Troubleshooting
Issues with loading Memgraph
docker load -i memgraph.tar.gz
Error during connect:
This error may indicate that the docker daemon is not running.
Run the Docker Desktop application and wait for it to load fully.
Error response from daemon:
open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
Reload the Docker Desktop application and wait for it to load fully.
Unsupported OS Linux
You need to download the Windows Subsystem for Linux (opens in a new tab), and enable experimental features in Docker Desktop, under Settings -> Docker Engine, change experimental to true.
Issues when connecting to Memgraph
docker run memgraph/memgraph-platform
While this command will start a Memgraph instance, not publishing the port will
cause problems when trying to connect to the database via Memgraph Lab or
mgconsole. To avoid this, you should publish the
container's port to the host using the -p
flag and by specifying the port:
docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform
Issues with connecting mgconsole
to the database
docker run -it --entrypoint=mgconsole memgraph/memgraph-platform --host HOST
Although unlikely, sometimes there are issues with connecting mgconsole to
the Docker Container’s IP address because it is running on a custom IP rather
than localhost
. This problem is most often accompanied with 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 (opens in a new tab) guide or
Mac (opens in a new tab) guide .
Issues with the IP address
Although unlikely, some users might experience minor difficulties after the
Docker installation. Instead of running on localhost
, a Docker container for
Memgraph may be running on a custom IP address. Fortunately, that IP address can
be found as follows:
1. Determine the ID of the Memgraph Container by issuing the
command docker ps
. The user should get an output similar to the following:
CONTAINER ID IMAGE COMMAND CREATED
9397623cd87e memgraph "/usr/lib/memgraph/m…" 2 seconds ago
At this point, it is important to remember the container ID of the Memgraph
Image. In our case, that is 9397623cd87e
.
2. Use the this ID to retrieve the IP address of the Container:
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 9397623cd87e
The command above will yield the IP address that should be used when connecting
to Memgraph via Memgraph Lab or mgconsole. Just replace
HOST
from the following command with the appropriate IP address:
docker run -it --entrypoint=mgconsole memgraph/memgraph-platform --host HOST