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映像,下面是:
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发布于 2020-02-19 05:11:58
我尝试运行问题中所示的命令,并遇到以下错误:
curl -O "https://www.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz"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
所以对我有用的命令是:
curl -O -k https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz一个重要的边注:
我假设您已经配置了网络权限,如果您在组织中运行代理,那么它具有所有正确的代理定义,否则您应该首先定义代理。
总之,我建议您先在运行docker build的机器上的对接器之外运行此命令“手动”(我指的是从命令行开始,而不是作为构建的一部分),并且只在确保它在停靠文件中运行时才能运行。
https://stackoverflow.com/questions/60291707
复制相似问题