从Dockerfile构建映像时无法连接debian prod

时间:2019-10-23 12:03:39

标签: docker docker-compose debian

我正在尝试复制该项目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

1 个答案:

答案 0 :(得分:0)

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

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

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