Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue installing MongoDB on alpine

Tags:

docker

alpine

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):
like image 606
focus zheng Avatar asked Dec 19 '18 11:12

focus zheng


Video Answer


2 Answers

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
like image 92
nickgryg Avatar answered Oct 26 '22 12:10

nickgryg


This worked for me... probably it will work for you 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

VOLUME ["/data/db"]
WORKDIR /data
EXPOSE 27017

Use /data folder because it is the defult one. Other names will give you error.

like image 25
DHEERAJ KUMAR GUPTA Avatar answered Oct 26 '22 14:10

DHEERAJ KUMAR GUPTA