I am getting this error while installing mongodb in docker
[5/6] RUN apk add mongodb=3.4.4-r0:
#8 0.327 ERROR: unable to select packages:
#8 0.328 mongodb (no such package):
#8 0.347 required by: world[mongodb=3.4.4-r0].
executor failed running [/bin/sh -c apk add mongodb=3.4.4-r0]: exit code: 1.
My Dockerfile code is given below which is similar to the StackOverflow solution but it is not working for me.
FROM alpine
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
CMD [ "mongod" ]
CodePudding user response:
You don't have to add the repositories, just set the alpine version:
FROM alpine:3.6
ENV TERM=linux
RUN apk add --no-cache bash mongodb=3.4.4-r0
RUN mkdir -p /data/db && \
chown -R mongodb /data/db
VOLUME /data/db
EXPOSE 27017
CMD [ "mongod", "--bind_ip", "0.0.0.0"]
CodePudding user response:
I hate to be "that guy", but trying to troubleshoot your solution, it just worked on my machine:
Ubuntu 20.04 on WSL2 (Windows 10) with Docker 20.10.17