8

Since mongodb changed their license, it is no longer available as an apk package on the alpine repository for alpine versions after 3.9.

Is there any way to install it on newer Alpines?

I am not sure what is the end game here - will we just be forever bound to an older Alpine version, or just be forced to only use the official mongo non-alpine docker image?

6

Not an ideal or a long term solution, but following the procedure described in this answer by Nikolay, you could install mongodb with its dependencies from an older Alpine version by wiring apk to the old Alpine repositories:

echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories
apk update
apk add mongodb yaml-cpp=0.6.2-r2
mongo -version

One caveat is that you have to pin yaml-cpp to version 0.6.2 due to a breaking ABI change - otherwise mongo will fail dynamic linking.

3
  • 2
    Thank you for this, but this is still a "pin to old version" and with even more problems, than just using Alpine 3.9. Is mongo on alpine really such a niche case that there is no official up to date support? – DannyB Feb 25 '20 at 13:56
  • @DannyB I'm not sure, but since this is a community package I guess it depends on things like maintainers availability and whether Mongo will offer official support. – valiano Feb 25 '20 at 14:16
  • 1
    @DannyB Even the OpenJDK project, for example, doesn't have yet full Alpine support, and openjdk packages are community built. OpenJDK official docker has ditched the Alpine community builds, and now uses only certified glibc OpenJDK binaries - on glibc-enabled Alpine containers. I'm not sure if it would work for you, but if you enable glibc on the Alpine container (so it's not pure musl libc anymore), you could use the mainstream Linux Mongo build, and still enjoy much of Alpine's image size saving. – valiano Feb 25 '20 at 14:20
-1

There are some mongodb-*.tgz packages for linux legacy x64 in official website:
- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.17.tgz
- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.17.tgz
...
These can work normally in alpine linux 3.11.

2
  • 1
    It absolutely does not work, as it can't find libresolv.so.2, while alpine only provides libresolv.a – redsPL Apr 4 '20 at 10:06
  • there may some error messages, but it still works, i've deployed it in production. – colben May 16 '20 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.