How To Deploy MongoDB With Docker On Ubuntu 20.04
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Mongo - Docker Hub - https://hub.docker.com/_/mongo
MongoDB document databases provide high availability and easy scalability. Docker is an open source platform for building, deploying, and managing containerized applications.
Offcial Website -https://www.docker.com/
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Testing Environment:Ubuntu 20.04 LTS Hostname - www.yourdomain.com - ip Address - 192.168.1.10
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
apt update ; apt install -y build-essential net-tools curl git software-properties-common neofetch apt-transport-https ca-certificates curl gnupg-agent docker.io docker-compose
systemctl enable --now docker ; docker --version ; docker-compose version
usermod -aG docker $USER ; newgrp docker
docker pull mongo:4.2.2
docker images
mkdir -p /mongodata
docker run -it -v /data/db:/mongodata -p 27017:27017 --name mongodb -d mongo
docker ps
docker exec -it mongodb bash
mongo -host localhost -port 27017
show dbs
docker logs mongodb
docker stop mongodb
docker start mongodb
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment