Issue installing MongoDB on alpine

focus zheng picture focus zheng · Dec 19, 2018 · Viewed 16.8k times · Source
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.6/community' >> /etc/apk/repositories
RUN apk update
RUN apk add mongodb==3.4.4-r0

RUN mongo --version

it show errors

ERROR: unsatisfiable constraints:
  so:libboost_chrono-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_chrono-mt.so.1.62.0]
  so:libboost_filesystem-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_filesystem-mt.so.1.62.0]
  so:libboost_iostreams-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_iostreams-mt.so.1.62.0]
  so:libboost_program_options-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_program_options-mt.so.1.62.0]
  so:libboost_regex-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_regex-mt.so.1.62.0]
  so:libboost_system-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_system-mt.so.1.62.0]
  so:libboost_thread-mt.so.1.62.0 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libboost_thread-mt.so.1.62.0]
  so:libcrypto.so.41 (missing):
    required by:
                 mongodb-3.4.4-r0[so:libcrypto.so.41]
  so:libssl.so.43 (missing):

Answer

nickgryg picture nickgryg · Dec 21, 2018

MongoDB version 3.4.4-r0 is located in Alpine v3.6 community repository and requires another packages like boost, boost-iostreams, boost-dev etc version 1.62.0-r5 to be installed. They are only available in Alpine v3.6 main repository. You just need to add that repository to alpine repository's list as well:

RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.6/main' >> /etc/apk/repositories
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.6/community' >> /etc/apk/repositories
RUN apk update
RUN apk add mongodb=3.4.4-r0

RUN mongo --version