I want to build this image to support arm64 architecture,but I don't find arm64 package at this http://repo.mongodb.org/apt/debian/dists/jessie/mongodb-org/3.5/Release , So I want to konw this image whether or not support arm64 architecture.
There are no MongoDB Debian Arm releases. You can install Ubuntu packages from http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.5/Release
@tianon - are there suitable alternatives available to put together a multiarch MongoDB Docker image based on Xenial?
@ehershey so would it be fair to say that upstream supports/recommends Ubuntu (specifically Xenial) over Debian? If so, it probably makes sense to simply switch the default base of this image on that basis alone, and then arm64 becomes a side benefit of following upstream's official recommendations more closely. :innocent:
Size difference for 3.5 on the current Debian Jessie vs Ubuntu Xenial is ~43MB increase (~371MB up to ~414MB). A tiny bit painful, but worth it IMO if the result is closer to upstream's official recommendation / willingness to officially support.
Edit: that's even cheating a little bit, since I updated gosu to 1.10 at the same time, which shrank that layer from ~3.79MB down to ~1.64MB. :innocent:
Just for reference, here's the 3.4 Dockerfile I built based on Xenial:
FROM ubuntu:xenial
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mongodb && useradd -r -g mongodb mongodb
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
jq \
numactl \
&& rm -rf /var/lib/apt/lists/*
# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.10
RUN set -ex; \
\
fetchDeps=' \
wget \
'; \
apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \
rm -rf /var/lib/apt/lists/*; \
\
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
\
# verify the signature
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
\
chmod +x /usr/local/bin/gosu; \
# verify that the binary works
gosu nobody true; \
\
apt-get purge -y --auto-remove $fetchDeps
RUN mkdir /docker-entrypoint-initdb.d
ENV GPG_KEYS \
# pub 4096R/A15703C6 2016-01-11 [expires: 2018-01-10]
# Key fingerprint = 0C49 F373 0359 A145 1858 5931 BC71 1F9B A157 03C6
# uid MongoDB 3.4 Release Signing Key <[email protected]>
0C49F3730359A14518585931BC711F9BA15703C6
# https://docs.mongodb.com/manual/tutorial/verify-mongodb-packages/#download-then-import-the-key-file
RUN set -ex; \
export GNUPGHOME="$(mktemp -d)"; \
for key in $GPG_KEYS; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done; \
gpg --export $GPG_KEYS > /etc/apt/trusted.gpg.d/mongodb.gpg; \
rm -r "$GNUPGHOME"; \
apt-key list
# Allow build-time overrides (eg. to build image with MongoDB Enterprise version)
# Options for MONGO_PACKAGE: mongodb-org OR mongodb-enterprise
# Options for MONGO_REPO: repo.mongodb.org OR repo.mongodb.com
# Example: docker build --build-arg MONGO_PACKAGE=mongodb-enterprise --build-arg MONGO_REPO=repo.mongodb.com .
ARG MONGO_PACKAGE=mongodb-org
ARG MONGO_REPO=repo.mongodb.org
ENV MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO}
ENV MONGO_MAJOR 3.4
ENV MONGO_VERSION 3.4.9
RUN echo "deb http://$MONGO_REPO/apt/ubuntu xenial/${MONGO_PACKAGE%-unstable}/$MONGO_MAJOR multiverse" | tee "/etc/apt/sources.list.d/${MONGO_PACKAGE%-unstable}.list"
RUN set -x \
&& apt-get update \
&& apt-get install -y \
${MONGO_PACKAGE}=$MONGO_VERSION \
${MONGO_PACKAGE}-server=$MONGO_VERSION \
${MONGO_PACKAGE}-shell=$MONGO_VERSION \
${MONGO_PACKAGE}-mongos=$MONGO_VERSION \
${MONGO_PACKAGE}-tools=$MONGO_VERSION \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mongodb \
&& mv /etc/mongod.conf /etc/mongod.conf.orig
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s usr/local/bin/docker-entrypoint.sh /entrypoint.sh # backwards compat
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 27017
CMD ["mongod"]
@tianon @ehershey it looks like a switch to a xenial base image may have even more plausible multiarch images in the future, based on testing http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/testing/multiverse/ having 5 arches (amd64, i386, arm64, ppc64el, s390x).
I wonder how many folks we'd break by switching to Xenial -- probably less
here than over in MariaDB. :smile:
@tianon just tested your docker file from this thread as it is (mongodb 3.4) and edited for mongodb 3.6 on a raspberry pi with 64 bit suse leap 42.3 --> it just works :-) (which is great)
I think you should somehow make it available either in exchange of this repo or if you worry about compatibility even under a different name...
Can official integration be considered?
@Ognian would you be able to share your code with me? I am having a lot of trouble running on a raspberry pi it never finish, always crashes on something. Thank you.
@rpascal there is nothing special, I'm using exactly @tianon 's Dockerfile posted 5 messages above this one and the docker-entrypoint.sh from this repo;
Meantime I've even switched to mongodb 3.6
the changes therefore are:
ENV GPG_KEYS \
# pub 4096R/91FA4AD5 2016-12-14 [expires: 2018-12-14]
# Key fingerprint = 2930 ADAE 8CAF 5059 EE73 BB4B 5871 2A22 91FA 4AD5
# uid MongoDB 3.6 Release Signing Key <[email protected]>
2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
# https://docs.mongodb.com/manual/tutorial/verify-mongodb-packages/#download-then-import-the-key-file
and
ENV MONGO_MAJOR 3.6
ENV MONGO_VERSION 3.6.0
The most troubles I had, was to to get the base os stable, I'm using now the latest fedora rawhide, but fedora 27 and SUSE leap 42.3 (all 64bit) worked also...
arm32v7 is not happing as upstream does not support it? Here I though I could use mongodb on my little Raspberry Pi 4 with 4GB of RAM.
Correct -- as far as I know, MongoDB upstream does not support any 32bit architectures (for many years now).
What I would suggest for your Raspberry Pi 4 is to run a 64bit kernel and then you should be able to run the arm64v8 version of MongoDB.
Correct -- as far as I know, MongoDB upstream does not support any 32bit architectures (for many years now).
What I would suggest for your Raspberry Pi 4 is to run a 64bit kernel and then you should be able to run the
arm64v8version of MongoDB.
Unfortunately, it's easier said than done as most popular distros still lacks aarch64 support for RPi4, but at least Gentoo has a stable aarch64 version so switched to that for now.
Funny how this is the result:
pi@RPi4-01 ~ $ docker pull mongo
Using default tag: latest
latest: Pulling from library/mongo
no matching manifest for linux/arm64/v8 in the manifest list entries
See https://github.com/docker-library/official-images/pull/7094#issuecomment-564244244 -- try mongo:4.0.
Also, this isn't a support forum, so I'd recommend taking this conversation to the Docker Community Forums, the Docker Community Slack, or Stack Overflow to continue it.
Problem is with the image having no arm64 manifest for latest tag, which it kinda should have, but correct way is to use: arm64v8/mongo and it works.
Most helpful comment
Size difference for 3.5 on the current Debian Jessie vs Ubuntu Xenial is ~43MB increase (~371MB up to ~414MB). A tiny bit painful, but worth it IMO if the result is closer to upstream's official recommendation / willingness to officially support.
Edit: that's even cheating a little bit, since I updated
gosuto 1.10 at the same time, which shrank that layer from ~3.79MB down to ~1.64MB. :innocent: