Docker安装Mongodb
一、宿主机创建目录,存放mongodb配置信息、数据信息
mkdir -p /usr/local/mymongo/conf
二、参考官方配置文档,配置mongod.conf
#在上面的conf目录下,创建mongod.conf
systemLog:
destination: file
path: /var/log/mongodb/mongod.log
logAppend: true
storage:
dbPath: /data/db
net:
bindIp: 0.0.0.0
port: 27017
setParameter:
enableLocalhostAuthBypass: false
security:
authorization: disabled
# 挂载配置文件 -v /usr/local/mymongo/conf:/etc/mongo
# 挂载数据 -v /usr/local/mymongo/data/db:/data/db
docker run -d --name my_mongo -v /usr/local/mymongo/conf:/etc/mongo -v /usr/local/mymongo/data/db:/data/db --restart=always mongo --config /etc/mongo/mongod.conf
本文来自博客园,作者:弩哥++,转载请注明原文链接:https://www.cnblogs.com/bangbangzoutianya/p/17769193.html