What is Docker"Docker is an open source application container engine that allows developers to package their applications and dependent packages into a portable container and then publish it to any popular Linux machine. It can also achieve virtualization. The container is completely sandboxed and there is no interface between them." MongoDB is a free, open source, cross-platform, document-oriented NoSQL database program. Here is a detailed tutorial on how to deploy MongoDB with Docker. deploy1. Pull the imageHere we pull the latest version of the image docker pull mongo:latest 2. View the imageAs you can see in the picture, the latest version of the mongo image has been installed. docker images 3. Run the containerAfter the installation is complete, you can use the command to run the mongo container, and finally view the container running information through the docker ps command docker run -itd --name mongo -p 27017:27017 mongo --auth
4. Create a UserThen enter the mongo container, add user admin 12345678, and log in to see if the creation is successful. docker exec -it mongo mongo admin db.createUser({ user:'admin',pwd:'12345678',roles:[ { role:'userAdminAnyDatabase', db: 'admin'},"readWriteAnyDatabase"]}); db.auth('admin', '12345678') 5. Connect to DBFirst enter the mongo container, log in as user admin 12345678, and execute show dbs to view the database. At this time, mongo has been deployed successfully. docker exec -it mongo mongo admin db.auth('admin', '12345678') show dbs 6. UINext, we use the UI interface to access MongoDB, enter the link information, and the connection will be successful. The above is the details of deploying MongoDB with Docker. For more information about deploying MongoDB with Docker, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Summary of MySQL 8.0 Online DDL Quick Column Addition
>>: Discussion on the problem of garbled characters in iframe page parameters
This article uses examples to describe the operat...
CSS: Copy code The code is as follows: *{margin:0;...
As shown below: 1. ssh -v -p [port number] [user ...
Table of contents Mysql master-slave synchronizat...
There are some tags in XHTML that have similar fu...
Compared with the old life cycle Three hooks are ...
You can have the best visual design skills in the...
To get straight to the point, there is a very com...
1. Varnish Overview 1. Introduction to Varnish Va...
Recently, new projects have used springcloud and ...
The json data must be returned in html format That...
Preface MySQL 8.0.13 began to support index skip ...
The front-end and back-end projects are separated...
Demand background The team has the need for integ...
Nginx supports three ways to configure virtual ho...