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" ]
2
Answers
You don’t have to add the repositories, just set the alpine version:
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