【问题标题】:Unable to connect debian prod while building the image from a Dockerfile从 Dockerfile 构建映像时无法连接 debian prod
【发布时间】:2019-10-23 12:03:39
【问题描述】:

我正在尝试复制这个项目https://github.com/tabulapdf/tabula.git,并且这个项目中有 dockerfile。我尝试从 dockerfile 构建映像,但在构建映像时出现错误提示“无法连接到 deb.debian.org:http:”

我尝试在 stackoverflow 中搜索相关问题,但不知道如何解决问题。

FROM jruby:9.1-jdk

RUN apt-get update -qq && apt-get install -y build-essential
RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc

ENV GEM_HOME /usr/local/bundle
ENV PATH $GEM_HOME/bin:$PATH
RUN gem install bundler -v '< 2' \
  && bundle config --global path "$GEM_HOME" \
  && bundle config --global bin "$GEM_HOME/bin"

这是我在构建图像时遇到的错误:

Step 1/17 : FROM jruby:9.1-jdk
 ---> 0de61e330d81
Step 2/17 : RUN apt-get update  && apt-get install -y apt-transport-https && apt-get install -y build-essential
 ---> Running in 5819127c82e0
Err:1 http://deb.debian.org/debian stretch InRelease
  Could not connect to prod.debian.map.fastly.net:80 (151.101.200.204). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (130.89.148.77). - connect (111: Connection refused) [IP: 130.89.148.77 80]
Err:2 http://deb.debian.org/debian stretch-updates InRelease
  Unable to connect to deb.debian.org:http: [IP: 130.89.148.77 80]
Err:3 http://security.debian.org/debian-security stretch/updates InRelease
  Could not connect to prod.debian.map.fastly.net:80 (151.101.200.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (128.31.0.63). - connect (111: Connection refused) [IP: 128.31.0.63 80]
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease  Could not connect to prod.debian.map.fastly.net:80 (151.101.200.204). - connect (111: Connection refused) Could not connect to deb.debian.org:80 (130.89.148.77). - connect (111: Connection refused) [IP: 130.89.148.77 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.200.204). - connect (111: Connection refused) Could not connect to security.debian.org:80 (128.31.0.63). - connect (111: Connection refused) [IP: 128.31.0.63 80]
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease  Unable to connect to deb.debian.org:http: [IP: 130.89.148.77 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package apt-transport-https
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update  && apt-get install -y apt-transport-https && apt-get install -y build-essential' returned a non-zero code: 100

【问题讨论】:

  • 这始终是本地网络设置的问题;这不是 SO 可以帮助解决的编程问题类型。
  • 有什么办法可以解决这个@DavidMaze

标签: docker docker-compose debian


【解决方案1】:

您必须在 Dockerfile 中包含代理参数:

ENV http_proxy http://XXX.XXX.XXX.XXX:XXXX

ENV https_proxy https://XXX.XXX.XXX.XXX:XXXX

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-22
    • 2017-04-16
    • 2019-12-15
    • 1970-01-01
    • 2022-10-06
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多