gpt4 book ai didi

mongodb - 在 docker 容器中安装 mongodb

转载 作者:IT老高 更新时间:2023-10-28 12:31:20 29 4
gpt4 key购买 nike

我正在尝试为 mongodb 创建一个 docker 镜像。我按照从官方 mongodb 安装到字母的安装说明进行操作,但没有成功。我已经尝试了每一个博客和安装说明,但没有任何成功。任何帮助将不胜感激。

我的 dockerfile 内容:

FROM ubuntu:16.04
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu/ xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-3.4.list

RUN apt-get update && apt-get install -y mongodb-org
RUN mkdir -p /data/db
RUN chown -R mongodb:mongodb /data/db
ADD mongodb.conf /etc/mongodb.conf
ADD mongodb.pem /etc/ssl/certs/mongodb.pem

VOLUME ["/data/db"]
EXPOSE 27017
ENTRYPOINT ["/usr/bin/mongod", "--config", "/etc/mongodb.conf"]

我正在使用以下命令:

sudo docker image build -t mongodb .

每次我尝试构建镜像时,都会得到以下信息:

Sending build context to Docker daemon   7.68kB
Step 1/11 : FROM ubuntu:16.04
---> 14f60031763d
Step 2/11 : RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
---> Using cache
---> 97a851663e60
Step 3/11 : RUN echo "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu/ xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-3.4.list
---> Using cache
---> 122a2fad0021
Step 4/11 : RUN apt-get update && apt-get install -y mongodb-org
---> Running in 014e7918e156
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Ign:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Get:3 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:6 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release [3457 B]
Get:7 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg [801 B]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [42.0 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [394 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.8 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [184 kB]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [2931 B]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:14 http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages [5870 B]
Err:14 http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4/multiverse amd64 Packages
Hash Sum mismatch
Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [208 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [756 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.3 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [645 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [17.5 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4930 B]
Get:25 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [6237 B]
Fetched 24.2 MB in 7s (3158 kB/s)
Reading package lists...
E: Failed to fetch http://alert.scansafe.net/alert/process?a=-3-BW4R_eLtf_R7PUTnlOeb6kHjw5kMPDH4n_j9vuji99G7a0CHJtXpeYpzGHZPC0wRr52uECxiceRo23F5y5nJqQ&b=iDw6Hli7TPC7hodjxRcdBj9i1UevoPI4aXCTkM2htEe16EENN3K7sUkicBLWMmbvQJHy5RccSqbLlHU4Q23W8w7vzekV399jAw6NbyJsJBJPm_U3VdYSosJyHFldLABeOaw16L56ass0uQ-KDLgyWadENbyoiMwzO-1nwE6QYwf1NcLI1073TBf9mObvKXGE7lL2-OpA1MA6dI2cdh6AETyP3g0OipJUm4fag2-7TI5j_BImQOsvvEVlzZ7ilSFaUVOlMbWBWuuU822y_f0ph82C3dG_kBenckmPWso5ln9ShKoiCmjbcSZjT76_j3Hwh3nSYYv1AqX8Kj8gFD4k1MI2Li7WNMs9rnq4vUa9eeaN_ivffMClQHK6I88vPaR4FQr61U5ecOwl0KmVyhP3FLDF-4KpOGg3Kf7kVRCnLpQZwXnsrrTt3enSpjn66IzlCgG3PmNrVhdqOTBQFh5PfWtgdGG68Ir6hZIBt170nqGSMhgFmlTMTMbO5EGkA-uyPz8worv7RSc&blockedUrl=http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.4/multiverse/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead.
The command '/bin/sh -c apt-get update && apt-get install -y mongodb-org' returned a non-zero code: 100

最佳答案

RUN apt-get update && apt-get install -y mongodb-org 行应该是RUN apt-get update && apt-get install -y mongodb 也可以只使用官方的mongo镜像,然后提供一个docker link

关于mongodb - 在 docker 容器中安装 mongodb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45449260/

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