-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.mongodb
37 lines (28 loc) · 1.46 KB
/
Dockerfile.mongodb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM ubuntu:xenial
MAINTAINER Milan Simonovic <[email protected]>
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mongodb -g 999 && useradd -r -g mongodb -u 999 mongodb
ENV MONGO_MAJOR 3.4
ENV MONGO_VERSION 3.4.1
ENV UBUNTU_REL xenial
ENV REFRESHED_AT 2017-01-12
# on major upgrades, get the new key from https://docs.mongodb.com/v$MONGO_MAJOR/tutorial/install-mongodb-on-ubuntu/
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 && \
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu $UBUNTU_REL/mongodb-org/$MONGO_MAJOR multiverse" | tee /etc/apt/sources.list.d/mongodb-org-$MONGO_MAJOR.list && \
apt-get update && \
apt-get install -y --no-install-recommends numactl \
mongodb-org-server=$MONGO_VERSION \
mongodb-org-shell=$MONGO_VERSION \
mongodb-org-tools=$MONGO_VERSION && \
echo "mongodb-org-server hold" | dpkg --set-selections && \
echo "mongodb-org-shell hold" | dpkg --set-selections && \
echo "mongodb-org-tools hold" | dpkg --set-selections && \
rm -rf /var/lib/apt/lists/* \
mv /etc/mongod.conf /etc/mongod.conf.orig
COPY mongod.conf /etc/mongod.conf
RUN chown -R mongodb:mongodb /var/lib/mongodb
VOLUME /var/lib/mongodb
EXPOSE 27017 28017
# drop back to the regular user - good practice
USER mongodb
CMD ["mongod","-f","/etc/mongod.conf"]