Mongodb Docker Tutorial | Mongodb On Docker With Persistent Volume & Authentication | Thetips4you
#MongoDB, #Databases, #Docker Hello Friends, Welcome back to my channel. We are going to see how we can setup mongodb database as docker container.we will see the docker commands to start a mongodb container with persistent storage and setting admin user name and password using environmental variables. We will see how you can connect to the mongodb database from windows machine and will also see the basic commands to create databases and collections etc.
——————————————————————————————————-
How to setup docker in Centos:
https://youtu.be/HZnLhpkc0s8
—————————————————————————————————–
—————————————————————————————————-
Running MySQL on Docker:
https://youtu.be/EG3RhQNl00o
—————————————————————————————————
—————————————————————————————————-
download mongodb compass : https://www.mongodb.com/try/download/compass
docker hub:
https://hub.docker.com/_/mongo
————————————————————————————————-
————————————————————————————————–
Docker Commands:
docker run -d –name mongodb -p 27017:27017 -v mongo_data:/data/db mongo:latest
docker run -d –name mongodb -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret -v mongo_data:/data/db mongo:latest
————————————————————————————————————-
————————————————————————————————————-
docker exec -it mongdb /bin/bash
mongo
or
mongo -u mongoadmin -p secret –authenticationDatabase admin
show dbs
show databases
use mondodbdatabase
show collections
db.createCollection(“collectionName”);
db.collectionName.insert({firstname: “bob”, lastname: “alan”})
db.collectionName.find()
———————————————————————————————————-
====================================================
Follow me @:
https://www.instagram.com/thetips4you
https://www.instagram.com/thetipsforyou
https://www.youtube.com/channel/UCoOq-DtESvayx5yJE5H6-qQ
https://www.facebook.com/thetipsforyou
http://www.thetips4you.com
=====================================================
Comments are closed.