CURL UNDER DOCKER IMAGE NGINX:STABLE FAILED curl:( 77) -A workaround to the problem
Here’s the typical error:
Step 6/18 : RUN curl --retry 7 -Lo ./consul-template.zip "https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip"
---> Running in 60072c905e79
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (77) error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
curl: (77) error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
After checking the Internet for quite a while I’ve got no idea at all. The problem is related to openssl obviously.
I tried the curl
command with exact options and parameters on MAC and also in nginx:stable
container directly. The problem just did not occur. Everything went well. But if I use docker-compose up
with
RUN curl --retry 7 -Lo ./consul-template.zip \
"https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip"
it will certainly fail.

Solution to avoid this problem is as below:
RUN echo insecure >> ~/.curlrc
As simple as that.
