[MongoDB] Install MongoDB Community Server on Docker

BLOG

7/1/20241 min lire

We describe for you the installation of a MongoDB Community Server on Docker

The first step is to install Docker itself, then the MongoDB engine.

> install Docker

# sudo yum install -y yum-utils

# sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# sudo systemctl start docker

# sudo docker run hello-world

> install Mongodb Server

# docker pull mongodb/mongodb-community-server

# docker run --name mongo -d mongodb/mongodb-community-server:latest

# docker container ls

> Connect to the MongoDB instance

# docker exec -it mongo mongosh