2.27. Docker install MongoDB

发布时间 :2025-10-25 12:31:04 UTC      

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>` __

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.