AI

Install Milvus Using Docker Compose

Docker Compose is a tool that is part of the Docker ecosystem that allows us to define and run the multi-container applications. Docker compose uses pre-defined YAML files to configure the application services and determine the creation and startup behavior of the associated containers in a single command. The YAML file contains application configuration details such as services, networks, volumns, container dependencies, and more.

What Is Milvus?

Milvus, on the other hand, is a free and open-source vector database that is used to build the machine learning and artificial intelligence applications. Milvus supports massive-scale vector data and high-performance vector similarity search.

Vectors are mathematical representations of objects. Similarity search is finding similar objects based on their vector representations. Vectors are used to power the tools such as image recognition, natural language processors, recommender systems, etc.

This tutorial aims to help you learn how to set up a Milvus database instance on your system using the Docker Compose utility.

Requirements:

In order to follow along with this tutorial, you need the following:

  1. Ubuntu or Debian-based distribution
  2. Sudo or root permissions on your system
  3. Network access to download the containers and dependencies

Once you meet the given requirements, we can proceed with the installation:

NOTE: Although the steps in this tutorial are demonstrated on an Ubuntu system, the method of installing Milvus works on any system with installed Docker.

Installing Docker on Ubuntu

Before installing Milvus, let us install Docker and the required tools on our systems.

The first step is to uninstall any conflicting packages. You can run the following command:

for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

Once completed, run the following command to setup the Docker repositories on your system:

sudo apt-get update
sudo apt-get install ca-certificates curl gnupg wget

Add the Docker official GPG key with the following command:

$ sudo install -m 0755 -d /etc/apt/keyrings
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg

To setup the Docker repository, run the following command:

echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"
$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Once completed, run the following command to update the apt index:

$ sudo apt-get update

Finally, install the Docker Engine, containerd, and Docker Compose tools by running the following command:

$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

The previous commands should download and configure the Docker engine, containerd, and Docker-compose utility.

Install Milvus Using Docker Compose

The next step is downloading and running Milvus on our system using Docker.

Start by downloading the Docker-compose YAML file for Milvus that allows us to configure a Milvus server:

$ wget https://github.com/milvus-io/milvus/releases/download/v2.2.9/milvus-standalone-docker-compose.yml -O docker-compose.yml

The previous command should download the “milvus-standalone-docker-compose.yml” from the Milvus Github page and save it in your current working directory as “docker-compose.yml”.

Once we have the Milvus YAML file, run the “docker-compose” command to start the Milvus server as follows:

$ sudo docker-compose up -d

This command should download the required dependencies and tools to run the Milvus server as defined in the YAML file.

Sample Output:

Creating milvus-etcd ... done
Creating milvus-minio ... done
Creating milvus-standalone ... done

Once the container creation is complete, the Docker containers will be running on your system including the standalone Milvus server.

You can confirm by running the “docker ps” command:

$ sudo docker-compose ps

Example Output:

NAME IMAGE
milvus-etcd quay.io/coreos/etcd:v3.5.5
milvus-minio minio/minio:RELEASE.2022-03-17T06-34-49Z
milvus-standalone milvusdb/milvus:v2.2.9

You should get a more detailed output including port bindings, services, creation time, etc.

Once you are done running the Milvus server, you can shut it down by running the following command:

$ sudo docker-compose down

This should stop all the running containers and shut down the Milvus server.

Conclusion

We discussed how to install Docker and use it to start a standalone Milvus server using the Docker Compose.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list