title: curl certificate fail in docker container
body: <p>I have a <code>Ubuntu 18.04 server</code> behind a <code>coporate proxy</code>.</p>
  
  <p>I set the <code>http_proxy</code> and <code>https_proxy</code> environment variable.</p>
  
  <p>The server is running <code>Docker 19.03</code> which is also configured to use the http_proxy and https_poxy.</p>
  
  <p>If a run <code>docker run -it ubuntu:18.04</code>, inside the container, I can do an <code>apt update</code>and <code>apt install curl -y</code></p>
  
  <p>Then I can do something like <code>curl www.google.com</code>.</p>
  
  <p>But it is not working with <code>https</code> : </p>
  
  <pre><code>root@1b6abfb4ff90:/# curl -v -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     
  0*   Trying 10.30.88.14...
  * TCP_NODELAY set
  * Connected to xxx (10.30.88.14) port 8080 (#0)
  * allocate connect buffer!
  * Establish HTTP proxy tunnel to raw.githubusercontent.com:443
  &gt; CONNECT raw.githubusercontent.com:443 HTTP/1.1
  &gt; Host: raw.githubusercontent.com:443
  &gt; User-Agent: curl/7.58.0
  &gt; Proxy-Connection: Keep-Alive
  &gt; 
  &lt; HTTP/1.1 200 Connected
  &lt; 
  * Proxy replied 200 to CONNECT request
  * CONNECT phase completed!
  * ALPN, offering h2
  * ALPN, offering http/1.1
  * successfully set certificate verify locations:
  *   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
  } [5 bytes data]
  * TLSv1.3 (OUT), TLS handshake, Client hello (1):
  } [512 bytes data]
  * CONNECT phase completed!
  * CONNECT phase completed!
  { [5 bytes data]
  * TLSv1.3 (IN), TLS handshake, Server hello (2):
  { [91 bytes data]
  * TLSv1.2 (IN), TLS handshake, Certificate (11):
  { [2741 bytes data]
  * TLSv1.2 (OUT), TLS alert, Server hello (2):
  } [2 bytes data]
  * SSL certificate problem: unable to get local issuer certificate
  * stopped the pause stream!
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  * Closing connection 0
  curl: (60) SSL certificate problem: unable to get local issuer certificate
  More details here: https://curl.haxx.se/docs/sslcerts.html
  </code></pre>
  
  <p>curl failed to verify the legitimacy of the server and therefore could not
  establish a secure connection to it. To learn more about this situation and
  how to fix it, please visit the web page mentioned above.</p>
  
  <p>Outside of the container, it's working fine.  I also tried exactly the same on another server that is not behind a proxy and it's working inside the container.</p>
  
  <p>So I suppose it is a configuration problem of the docker deamon.  Or maybe I'm wrong ...
  What would be the solution ?</p>