首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用CURL下载Apache是超时的。

使用CURL下载Apache是超时的。
EN

Stack Overflow用户
提问于 2020-02-19 01:24:21
回答 1查看 2.5K关注 0票数 0
代码语言:javascript
复制
curl -O "https://www.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz"

这是我从终端下载maven的命令,但不是超时就是curl: (7) Failed to connect to www.apache.org port 443: Operation timed out.

如果我使用浏览器下载,没有问题。

我的假设是ssl连接或证书问题。知道我怎么解决卷发问题吗。

请注意,我正在一个Dockerfile中使用它来创建docker映像,下面是:

代码语言:javascript
复制
FROM ******/mule-42x:v2.2.1

ENV MAVEN_VERSION 3.6.3

RUN mkdir -p /opt/maven \
  && cd /opt/maven \
  && curl -O "https://www.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" \
  && tar xzvf "apache-maven-$MAVEN_VERSION-bin.tar.gz" \
  && rm "apache-maven-$MAVEN_VERSION-bin.tar.gz"

ENV MAVEN_HOME "/opt/maven/apache-maven-$MAVEN_VERSION"

ENV PATH=$MAVEN_HOME/bin:$PATH
EN

回答 1

Stack Overflow用户

发布于 2020-02-19 05:11:58

我尝试运行问题中所示的命令,并遇到以下错误:

代码语言:javascript
复制
curl -O "https://www.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz"

  1. curl试图验证SSL证书,但失败时使用以下消息:

代码语言:javascript
复制
curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

因此,我添加了-k标志,正如消息所暗示的那样。

https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

  1. 现在起作用了,但是http返回了带有302 (重定向)到的
    1. 页面。

所以对我有用的命令是:

代码语言:javascript
复制
curl -O -k https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

一个重要的边注:

我假设您已经配置了网络权限,如果您在组织中运行代理,那么它具有所有正确的代理定义,否则您应该首先定义代理。

总之,我建议您先在运行docker build的机器上的对接器之外运行此命令“手动”(我指的是从命令行开始,而不是作为构建的一部分),并且只在确保它在停靠文件中运行时才能运行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60291707

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档