需注意,docker版本不能太低,否则执行会报:missing signature key(缺少签名密钥):需要重新安装docker,所以docker最开始最好安装新版本:yum install docker-ce -y
参考的链接:
https://www.4vsy.com/article/231.html,
https://blog.csdn.net/qq_25430563/article/details/127977667
docker安装新版后,调整如下命令目录、密码后,执行即可:
docker run --name mongo -d --restart=always -p 27017:27017 -v /usr/local/tool/server/mongodb-4.2/data:/data/db -v /usr/local/tool/server/mongodb-4.2/backup/:/data/backup -v /usr/local/tool/server/mongodb-4.2/logs:/data/log -v /usr/local/tool/server/mongodb-4.2/conf:/data/conf -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=你的密码 mongo:5.0.8 mongo --host 127.0.0.1 -u "root" --authenticationDatabase "admin" -p '你的密码'
end
标签:安装,mongodb,tool,data,usr,MongoDB,docker,local From: https://www.cnblogs.com/xh_Blog/p/18060706