centos7 在docker下安装mongodb
程序员文章站
2022-04-15 10:49:19
...
1、直接说明过程步骤:在docker中查找mongo相对应的版本
docker search mongo
得到下面一系列信息:
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mongo MongoDB document databases provide high avai… 7050 [OK]
mongo-express Web-based MongoDB admin interface, written w… 737 [OK]
tutum/mongodb MongoDB Docker image – listens in port 27017… 229 [OK]
bitnami/mongodb Bitnami MongoDB Docker Image 123 [OK]
mongoclient/mongoclient Official docker image for Mongoclient, featu… 85 [OK]
mongooseim/mongooseim Small docker image for MongooseIM - robust a… 19
frodenas/mongodb A Docker Image for MongoDB 18 [OK]
cvallance/mongo-k8s-sidecar Kubernetes side car to setup and maintain a … 16 [OK]
arm64v8/mongo MongoDB document databases provide high avai… 9
centos/mongodb-32-centos7 MongoDB NoSQL database server 8
circleci/mongo CircleCI images for MongoDB 8 [OK]
webhippie/mongodb Docker images for MongoDB 7 [OK]
istepanov/mongodump Docker image with mongodump running as a cro… 6 [OK]
centos/mongodb-36-centos7 MongoDB NoSQL database server 5
centos/mongodb-26-centos7 MongoDB NoSQL database server 5
neowaylabs/mongodb-mms-agent This Docker image with MongoDB Monitoring Ag… 4 [OK]
eses/mongodb_exporter mongodb exporter for prometheus 4 [OK]
requilence/mongodb-backup mongo backup container 4 [OK]
centos/mongodb-34-centos7 MongoDB NoSQL database server 3
andreasleicher/mongo-azure-backup a docker container to backup a mongodb using… 2 [OK]
openshift/mongodb-24-centos7 DEPRECATED: A Centos7 based MongoDB v2.4 ima… 1
ansibleplaybookbundle/mongodb-apb An APB to deploy MongoDB. 1 [OK]
ekesken/mongo docker image for mongo that is configurable … 1 [OK]
phenompeople/mongodb MongoDB is an open-source, document databas… 0 [OK]
targetprocess/mongodb_exporter MongoDB exporter for prometheus
2、拉取最新的mongo版本
docker pull mogo
[aaa@qq.com ~]# docker pull mongo
Using default tag: latest
latest: Pulling from library/mongo
a1125296b23d: Pull complete
3c742a4a0f38: Pull complete
4c5ea3b32996: Pull complete
1b4be91ead68: Pull complete
af8504826779: Pull complete
8faaabd5f8b2: Pull complete
b7bb90b3c1e5: Pull complete
04f4b579cf84: Pull complete
33b916e924f1: Pull complete
a805b21b6014: Pull complete
7775fed63862: Pull complete
94226c388074: Pull complete
bdf7bf6a32e9: Pull complete
Digest: sha256:6d09cb4a2abbf0b333aa7e4f69c74d17699eeabf17f20a2265453bc8d1c1f5ac
Status: Downloaded newer image for mongo:latest
docker.io/library/mongo:latest
3、这个时候我们可以输入docker images命令查看我们所创建好的mongo容器:
[aaa@qq.com ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mongo latest 6d11486a97a7 2 weeks ago 388MB
4、创建容器并且运行:
[aaa@qq.com ~]# docker run -itd --name mongo -p 27017:27017 mongo
4af1e2b5bd108f8a934f656ab2de51688733deca8550e8a3cabb11c298922430
5、之后我们就可以进入我们的数据库进行操作了