5 Minutes to Memgraph using Docker Extension
Published: 2022-12-28 03:52:51


Memgraph is a high-performance, distributed in-memory graph database. It is designed to handle large volumes of data and complex queries, making it suitable for applications that require real-time analysis and processing of connected data.

One of the main problems that Memgraph aims to solve is the efficient storage and processing of complex, interconnected data. Graph databases are particularly well-suited for this task because they are designed to represent and store data as a series of relationships between entities. This allows for faster querying and analysis of data, as well as the ability to easily represent and explore complex relationships between different pieces of data.
 
## What is Memgraph Platform?
 
Memgraph Platform is a fully managed graph database service that is built on top of the Memgraph database engine. It provides a cloud-based, turnkey solution for deploying and running Memgraph in a production environment.

The main difference between Memgraph and Memgraph Platform is that Memgraph Platform is a fully managed service, while Memgraph is an open-source database engine that can be run on-premises or in a cloud environment. This means that with Memgraph Platform, you don't need to worry about installing, configuring, or managing the underlying database engine. Instead, you can simply create a Memgraph Platform cluster and start using it right away.

Other differences between Memgraph and Memgraph Platform include:

- **Scalability**: Memgraph Platform allows you to scale your cluster up or down as needed, which is not possible with the open-source version of Memgraph.

- **High availability**: Memgraph Platform includes built-in high availability features, such as automatic failover and data replication, which are not available in the open-source version of Memgraph.

- **Security**: Memgraph Platform includes a number of security features, such as encryption at rest and network isolation, which are not available in the open-source version of Memgraph.

Overall, Memgraph Platform is designed to be a fully managed, cloud-based solution for deploying and running Memgraph in a production environment, while Memgraph is an open-source database engine that can be run on-premises or in a cloud environment.
 
## How Memgraph works?
 
Memgraph is a distributed, in-memory graph database that is designed to handle large volumes of data and complex queries. It stores data as a series of nodes (also known as vertices) and edges, which represent the relationships between the nodes.

In Memgraph, data is stored in an in-memory database, which means that it is held in the main memory (RAM) of the computer rather than on a hard disk or other persistent storage device. This allows for faster access to the data and makes it easier to process complex queries in real-time.

Memgraph uses a query language called Cypher to retrieve and manipulate data. Cypher is a declarative language that allows users to specify what data they want to retrieve or modify, rather than specifying how to retrieve or modify it. This makes it easier for users to write complex queries and helps to reduce the complexity of the underlying code.

Memgraph also includes a number of advanced features, such as support for real-time data processing, distributed queries, and horizontal scaling, which make it well-suited for handling large volumes of data and complex queries.
 
## How is Memgraph different from other graph databases?
 
There are several key differences between Memgraph and other graph databases:

- Performance: Memgraph is designed to be a high-performance graph database, with a focus on real-time data processing and the ability to handle large volumes of data and complex queries.

- In-memory storage: Memgraph stores data in-memory, rather than on a persistent storage device like a hard disk. This allows for faster access to data and makes it easier to process complex queries in real-time.

- Distributed architecture: Memgraph is designed to be distributed, which means that it can scale horizontally across multiple machines. This allows it to handle large volumes of data and complex queries more efficiently.

- Query language: Memgraph uses Cypher, a declarative language, for querying and manipulating data. This makes it easier for users to write complex queries and helps to reduce the complexity of the underlying code.

- Advanced features: Memgraph includes a number of advanced features, such as support for real-time data processing, distributed queries, and horizontal scaling, which make it well-suited for handling large volumes of data and complex queries.

Overall, Memgraph is designed to be a fast, scalable, and powerful graph database that is well-suited for applications that require real-time analysis and processing of connected data.
 

## Running Memgraph in a Docker container
 
There are several reasons why you might want to run Memgraph in a Docker container:

**Portability**: Docker containers allow you to package an application and its dependencies into a single, portable unit that can be easily moved between different environments. This makes it easier to deploy Memgraph in different environments, such as on different machines or in the cloud.

**Isolation**: Running Memgraph in a Docker container allows you to isolate it from the rest of the system, which can help to prevent conflicts with other applications or libraries.

**Ease of use**: Docker provides an easy-to-use interface for running and managing containers, which makes it easier to set up and use Memgraph.

**Scalability**: Docker provides built-in support for scaling containers, which makes it easier to scale Memgraph up or down as needed.

Overall, running Memgraph in a Docker container can provide a number of benefits, including portability, isolation, ease of use, and scalability.


To run Memgraph as a Docker container, you will need to have Docker installed on your system. You can then follow these steps:

## Step 1. Pull the latest Memgraph Docker image 

Run the following command to pull the latest Memgraph Docker image from the Docker Hub:

```
docker pull memgraph/memgraph
```

## Step 2. Run the Memgraph Docker image 

Run the Memgraph in a container using the following command:

```
docker run -p 7687:7687 -d memgraph/memgraph
```

This will start the Memgraph database in a Docker container and expose the database's ports (7687) to the host machine.

Connect to the Memgraph database using a client tool such as Memgraph Lab or the Memgraph CLI. To connect using Memgraph Lab, open your web browser and go to `http://localhost:7687`. To connect using the Memgraph CLI, use the following command:

```
memgraph-cli -h localhost -p 7687
```

You should now be able to connect to the Memgraph database and start working with it.

Note: The steps above will run Memgraph in a single-node configuration. If you want to run a cluster of Memgraph nodes, you will need to use a different set of commands and configuration options. Please refer to the Memgraph documentation for more information on how to set up a multi-node cluster.


## Running Memgraph as a Docker Extension

With Memgraph Docker Extension, now you can set up the Memgraph platform in no seconds.


![Image1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzh7yusdjtqw67lsj60t.png)


## Getting Started

If you're in hurry, [click here to deploy it on Docker Desktop](https://open.docker.com/extensions/marketplace?extensionId=ajeetraina/memgraph-docker-extension&tag=latest). Ensure that you have Docker Desktop installed on your system

## Prerequisite

- Docker Desktop 4.8+

## Building the Extension locally

### Clone the repo

```
git clone https://github.com/collabnix/memgraph-docker-extension
```

### Build the Extension

```
cd memgraph-docker-extension
make build-extension
```

## Install the Extension

```
docker extension install ajeetraina/memgraph-docker-extension:latest
```

### Accessing the Extension

Open Docker Dashboard > Extension > Memgraph

Load the Pandora Papers data and see how to access it via Memgraph.


![Image3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/780ko3rxf0uld1899ah9.png)