Home > Software engineering >  Docker containers cannot access HTTPS addresses
Docker containers cannot access HTTPS addresses

Time:01-01

I got a new Windows 10 machine where I installed all my dev tools including Docker desktop. I noticed that the containers I spun up couldn't access any HTTPS address. A .NET 6-based application that I ran using docker-compose on my old machine without any issues, threw this error on the new one:

error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json

To verify this, I ran an Ubuntu container and shelled into it:

docker run -it ubuntu /bin/bash

then I installed curl:

apt update
apt install curl

then I tried curl with the nuget address:

curl https://api.nuget.org/v3/index.json

which failed with the following error message:

curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.se/docs/sslcerts.html 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.

I ran into similar issues with other applications I tried to run (applications that needed to access some HTTPS addresses) and made sure this wasn't about a specific address. Docker containers seem to fail to access any HTTPS address but have no issues connecting to HTTP ones. I'm not sure what setting enabled access to HTTPS addresses on my old machine. I installed Docker Desktop the same way I did before and didn't tweak any settings or create any bridge network. No proxies or anti-viruses on either machine. Any idea what might have caused this?

CodePudding user response:

You need to install SSL certificates in the Ubuntu container.

apt-get update
apt-get install ca-certificates

CodePudding user response:

I ended up downgrading Docker desktop from 4.15.0 to 4.9.1 and now everything works.

  • Related