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 illustrate the usag...
Table of contents Preface Stored Procedure: 1. Cr...
Table of contents 1. What is a cursor? 2. How to ...
Preface The source code is only more than 100 lin...
Table of contents Comprehensive comparison From t...
How to shorten the page rendering time on the bro...
Table of contents Preface Child components pass d...
The results are different in Windows and Linux en...
<br />Original address: http://andymao.com/a...
Problem Description I want to achieve the followi...
<br />Reading is a very important part of th...
Analyze the execution process. Move the mouse int...
The future of CSS is so exciting: on the one hand,...
Introduction The default source of Ubuntu is not ...
Following the previous article 202 Free High-Qual...