Software⏱️ 3 min read📅 2026-06-11

How to Fix: SSL: CERTIFICATE_VERIFY_FAILED error in a docker container

Docker container issue with SSL certificate verification failed error, unable to install pip package.

Quick Answer: Check the Docker container's openssl configuration and ensure it is set up correctly for HTTPS connections.

The SSL: CERTIFICATE_VERIFY_FAILED error occurs when the docker container is unable to verify the security certificate of a website, in this case, PyPI. This affects users who are installing packages using pip within their docker containers.

This issue can be frustrating because it prevents the user from successfully installing required packages for their application, leading to delays and potential project downtime.

🔍 Why This Happens

  • The primary reason for this error is that the docker container is missing the necessary OpenSSL libraries or configuration to verify SSL certificates. This is a common issue in docker environments where the openssl package is not properly installed or configured.
  • Another possible cause could be an outdated version of OpenSSL or an incorrect configuration, which can prevent the docker container from verifying SSL certificates.

🔧 Proven Troubleshooting Steps

Enabling SSL Verification using Docker

  1. Step 1: Step 1: Update the docker configuration to enable SSL verification. This can be done by adding the following line to the /etc/docker/daemon.json file: \
  2. Step 2: "tlsVerify": true\n"
  3. Step 3: Step 2: Restart the docker service to apply the changes. Run the command:\n
  4. Step 4: sudo systemctl restart docker\n"
  5. Step 5: Step 3: Verify that SSL verification is enabled by running the following command:\n
  6. Step 6: sudo docker inspect -f '{{.NetworkSettings.TLSVerify}}' \n"

Installing OpenSSL or Updating the Existing Version

  1. Step 1: Step 1: Install OpenSSL using apt-get. Run the following command:\n
  2. Step 2: sudo apt-get update && sudo apt-get install -y libssl-dev\n"
  3. Step 3: Step 2: Update the existing version of OpenSSL to the latest one. Run the following command:\n
  4. Step 4: sudo apt-get update && sudo apt-get upgrade openssl\n"

✨ Wrapping Up

To resolve the SSL: CERTIFICATE_VERIFY_FAILED error in a docker container, enable SSL verification using the docker configuration or install OpenSSL or update the existing version. By following these steps, users can successfully install packages using pip within their docker containers.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions