在Alpine映像上安装MongoDB时出现问题

时间:2020-01-16 02:49:41

标签: mongodb docker dockerfile

我正在尝试在Alpine映像上安装MongoDB,但我不断收到错误消息:

PS C:\Drive D\Docker Image Root\Docker Image MongoDB Java> docker build -t bohdan57/alpine-jdk11-mongo .
Sending build context to Docker daemon  7.746MB
Step 1/7 : FROM alpine:3.11.2
 ---> cc0abc535e36
Step 2/7 : ENV MONGODB_VERSION=3.2.10-r1
 ---> Using cache
 ---> 0c5220a9160e
Step 3/7 : RUN apk update && apk --no-cache --update add mongodb
 ---> Running in 8558d14e3a07
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
v3.11.2-78-g48c2d33662 [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.2-75-g5f284a899b [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
OK: 11263 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  mongodb (missing):
    required by: world[mongodb]
The command '/bin/sh -c apk update && apk --no-cache --update add mongodb' returned a non-zero code: 1

我检查了可用的软件包,并仅发现以下这些软件包:

/ # apk search -v 'mongo*'
mongo-c-driver-dev-1.15.1-r0 - Client library written in C for MongoDB (development files)
suitesparse-5.6.0-r0 - A collection of sparse matrix libraries
mongodb-tools-4.2.1-r0 - The MongoDB tools provide import, export, and diagnostic capabilities.
mongo-c-driver-1.15.1-r0 - Client library written in C for MongoDB
mongo-c-driver-doc-1.15.1-r0 - Client library written in C for MongoDB (documentation)
mongo-c-driver-static-1.15.1-r0 - Client library written in C for MongoDB (static library)

还检查了其他基于Alpine并安装了mongo的图像。他们都尝试安装此软件包

ENV  MONGODB_VERSION=3.2.10-r1
RUN apk --no-cache --update add mongodb@edge=$MONGODB_VERSION 

当我运行它甚至尝试仅安装“ mongodb”软件包时,都会收到错误消息:

/ # apk --no-cache --update add mongodb
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  mongodb (missing):
    required by: world[mongodb]

这是否意味着在Alpine上没有MongoDB的软件包? 我知道我可以立即下载mongo图像,但我很好奇自己这样做。将不胜感激任何建议:)

我的Dockerfile:

FROM alpine:3.11.2

RUN apk update &&  apk --no-cache --update add openjdk11 && apk --no-cache --update add mongodb

WORKDIR /var/tmp/

COPY JDBCmusic.jar .

LABEL belongsTo = "Bohdan Milenko"

CMD ["java", "-jar", "JDBCmusic.jar"]

0 个答案:

没有答案