1. Directory structure, put the configuration files here, and so on to copy into the image to 2.mongod.conf
net:port:27017 bindip:0.0.0.0security:authorization:enabledsystemlog:destination:file Path: "/data/log/mongod. Log "LogAppend:truestorage:dbPath:"/data/db "#processManagement: # Fork:true
3. Dockerfile
#FROM debian:wheezyfrom ubuntu# add our user and group first to make sure their ids get assigned consistently, regardless of whatever dependencies get addedRUN groupadd -r mongodb && useradd -r -g mongodb mongodbrun apt-get update run apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0c49f3730359a14518585931bc711f9ba15703c6run echo "Deb [ arch=amd64,arm64 ] http ://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse " | tee /etc/apt/ sources.list.d/mongodb-org-3.4.listrun apt-get updaterun apt-get install -y mongodb-orgrun mkdir -p /data/db /data/log /data/configdb && chown -r mongodb:mongodb /data/db /data/log /data/configdbvolume /data/db /data/log /data/configdbcopy ./ mongod.conf /data/configdb#copy docker-entrypoint.sh /entrypoint.sh#entrypoint ["/ Entrypoint.sh "]expose 27017cmd [" Mongod "]
http://www.waitingfy.com/archives/3376
Docker executes commands at a time
Docker MongoDB Dockerfile Ubuntu