gpt4 book ai didi

mongodb - 在 Alpine 镜像上安装 MongoDB 的问题

转载 作者:行者123 更新时间:2023-12-02 18:18:34 30 4
gpt4 key购买 nike

我正在尝试在 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"]

最佳答案

我从 this answer 收到的.它添加了一些存储库以满足要求,然后尝试安装。尝试以下 dockerfile

FROM alpine:3.11.2

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 && 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"]

关于mongodb - 在 Alpine 镜像上安装 MongoDB 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59762376/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com