2
當前正在考慮在容器中部署mongo。到目前爲止,我的文件看起來像,在Docker容器中保護Mongo安全
############################################################
# Dockerfile to build Mongo Containers
# Based on Ubuntu
############################################################
# Set the base image to Ubuntu
FROM ubuntu:14.04
# File Author/Maintainer
MAINTAINER Maintaner felix001
# Create repo file
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
RUN echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
# Update the default application repository sources list
RUN apt-get update && apt-get install -y \
mongodb-org \
vim
# Create the MongoDB data directory
RUN mkdir -p /data/db
# Expose port 27017 from the container to the host
EXPOSE 27017
# Set usr/bin/mongod as the dockerized entry-point application
ENTRYPOINT ["/usr/bin/mongod"]
不過,我需要,所以你需要一個密碼來執行任何管理措施,並創建一個數據庫/用戶鎖定蒙戈。所以我的問題是2倍,
什麼是最好的安全方法?到目前爲止,我有,
vim /etc/mongod.conf + auth = true use admin db.createUser({ user:"admin", pwd:"secretpassword", roles: ["dbAdminAnyDatabase","clusterAdmin"]}) use example db.createUser({ user:"user1", pwd:"abc123", roles:["readWrite"] })
什麼是將此添加到Dockerfile的最佳方法?
感謝,