2.27. Docker install MongoDB

发布时间 : 2025-10-25 13:32:37 UTC      

Page Views: 9 views

MongoDB is a free open source cross-platform document-oriented NoSQL database program.

2.27.1. 1. View the available MongoDB versions

Access MongoDB Mirror Library address: https://hub.docker.com/_/mongo?tab=tags&page=1 .

You can view other versions of MongoDB through Sort by. The default is the latest version. mongo:latest .

` <../wp-content/uploads/2016/06/docker-mongo1.png>` __

You can also find other versions you want in the drop-down list:

` <../wp-content/uploads/2016/06/docker-mongo2.png>` __

In addition, we can use the docker search mongo command to view the available versions:

$ docker search mongo NAME DESCRIPTION STARS OFFICIAL AUTOMATED mongo MongoDB document databases ... 1989 [OK] mongo-express Web-based MongoDB admin int... 22 [OK] mvertes/alpine-mongo light MongoDB container 19 [OK] mongooseim/mongooseim-docker MongooseIM server the lates... 9 [OK] torusware/speedus-mongo Always updated official Mon... 9 [OK] jacksoncage/mongo Instant MongoDB sharded cluster 6 [OK] mongoclient/mongoclient Official docker image for M... 4 [OK] jadsonlourenco/mongo-rocks Percona Mongodb with Rocksd... 4 [OK] asteris/apache-php-mongo Apache2.4 + PHP + Mongo + m... 2 [OK] 19hz/mongo-container Mongodb replicaset for coreos 1 [OK] nitra/mongo Mongo3 centos7 1 [OK] ackee/mongo MongoDB with fixed Bluemix p... 1 [OK] kobotoolbox/mongo https://github.com/kobotoolb... 1 [OK] valtlfelipe/mongo Docker Image based on the la... 1 [OK] 

2.27.2. 2. Take the latest version of MongoDB image

Here we pull the official image of the latest version:

$ docker pull mongo:latest 

` <../wp-content/uploads/2016/06/docker-mongo3.png>` __

2.27.3. 3. View the local image

Use the following command to see if mongo is installed:

$ docker images 

` <../wp-content/uploads/2016/06/docker-mongo4.png>` __

You can see in the figure above that we have installed the latest version (latest) of the mongo image.

2.27.4. 4. Run the container

After the installation is complete, we can run the mongo container using the following command:

$ docker run -itd --name mongo -p 27017:27017 mongo --auth 

Parameter description:

  • -p 27017:27017 Map port 27017 of CCS to port 27017 of host External users can access mongo’s services directly through the host ip:27017.

  • –auth A password is required to access CCS.

` <../wp-content/uploads/2016/06/docker-mongo5.png>` __

2.27.5. 5. Installation succeeded

Finally, we can pass through docker ps Command to view the running information of the container:

` <../wp-content/uploads/2016/06/docker-mongo6.png>` __

Then use the following command to add the user and set the password, and try to connect.

$ docker exec -it mongo mongo admin # 创建一个名为 admin,密码为 123456 的用户。 > db.createUser({ user:'admin',pwd:'123456',roles:[ { role:'userAdminAnyDatabase', db: 'admin'},"readWriteAnyDatabase"]}); # 尝试使用上面创建的用户信息进行连接。 > db.auth('admin', '123456') 

` <../wp-content/uploads/2016/06/docker-mongo7.png>` __

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。