gpt4 book ai didi

docker - apt-get install apt-transport-https 在 Docker 中失败

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

我有一个基于 FROM jenkins/jenkins:2.179 的 Docker 容器图片。
RUN安装 dotnet core 的一些命令:

FROM jenkins/jenkins:2.179

RUN apt-get update && \
apt-get -y install sudo && \
sudo apt-get install apt-transport-https

一旦到达 sudo apt-get install apt-transport-https它失败并提示:
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease  Could not connect to prod.debian.map.fastly.net:80 (151.101.112.204). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (5.153.231.4). - connect (111: Connection refused) [IP: 5.153.231.4 80]
W: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/InRelease Could not connect to prod.debian.map.fastly.net:80 (151.101.112.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (217.196.149.233). - connect (111: Connection refused) [IP: 217.196.149.233 80]
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease Unable to connect to deb.debian.org:http: [IP: 5.153.231.4 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

知道为什么会这样吗?

最佳答案

我无法重现这一点,因此容器的互联网连接可能有问题(可能是代理问题,正如 Marc 建议的那样)或者当您尝试构建图像时源当前不可用。

在另一个主题上——当我试图用你的确切代码重现这个时,我遇到了错误:

E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)

因为您最终也可能会遇到这种情况,所以您不应该使用 sudo在你的 Dockerfile 中。尝试这样的事情:
FROM jenkins/jenkins:2.179

USER root
RUN \
whoami \ # This will print "root"...
&& apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https

USER jenkins
RUN whoami # ... and this will print "jenkins"

关于docker - apt-get install apt-transport-https 在 Docker 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56460494/

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