Install Memgraph on macOS with Docker
This article briefly outlines the basic steps necessary to install and run Memgraph on macOS with Docker.
Prerequisitesβ
Before you proceed with the installation guide make sure that you have:
- Installed Docker. Instructions on how to do this can be found on the official Docker website.
- Downloaded the latest Memgraph Docker Image which can be found here.
info
Memgraph's Docker image was built with Docker version 1.12
and
should be compatible with all newer versions.
Installation guideβ
If you installed Docker and downloaded the latest Memgraph Docker image, import the image using the following command:
docker load -i /path/to/memgraph-<version>-docker.tar.gz
To start Memgraph, use the following command:
docker run -p 7687:7687 \
-v mg_lib:/var/lib/memgraph \
-v mg_log:/var/log/memgraph \
-v mg_etc:/etc/memgraph \
memgraph
Docker Volumes
Docker containers donβt persist data by default (all changes are lost when the
container is stopped). You need to use local volumes to store the data
permanently which is why Memgraph is started with the -v
flags. More
information on Docker Volumes can be found
here.
If successful, you should see a message similar to the following:
You are running Memgraph v1.4.0-community
If you want to start Memgraph with different configuration settings, check out the section below. At this point, Memgraph is ready for you to submit queries.
info
The username and password for connecting to the database are empty by default.
Stopping Memgraphβ
To stop a Memgraph database instance, run the following command:
docker stop CONTAINER_NAME
You can find the name of the container (CONTAINER_NAME
) by running:
docker ps
Configurationβ
The Memgraph configuration is available in Docker's named volume mg_etc
. On
Linux systems, it should be in
/var/lib/docker/volumes/mg_etc/_data/memgraph.conf
. Keep in mind that this way
of specifying configuration options is only valid if Memgraph was started using
volumes.
When using Docker, you can also specify the configuration options in the docker
run
command:
docker run -p 7687:7687 memgraph --bolt-port=7687
To learn about all the configuration options, check out the Reference guide.
Named volumesβ
If it happens that the named volumes are reused between different Memgraph versions, Docker will overwrite a folder within the container with existing data from the host machine. If a new file is introduced, or two versions of Memgraph are not compatible, some features might not work or Memgraph might not be able to work correctly. We strongly advise you to use different named volumes for different Memgraph versions, or to remove the existing volume from the host with the following command:
docker volume rm <volume_name>
Where to next?β
If you need more information on working with Docker, check out this
guide.
To learn how to query the database, take a look at the
Querying guide or Memgraph
Playground for interactive tutorials.
Visit the Building
applications
page if you need to connect to the database programmatically.
Getting helpβ
If you run into problems during the installation process, check out our installation troubleshooting guide to see if have already covered the topic. For more information on the installation process and for additional questions, visit the Getting help page.