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

How to Fix: Cannot push docker image to private registry - cert error

Docker image push to private registry with self-signed certificate fails due to unknown authority. Solution involves adding registry to insecure-registries in daemon.json.

Quick Answer: Add the registry to the insecure-registries list in /etc/docker/daemon.json and restart Docker for changes to take effect.

The 'Cannot push docker image to private registry - cert error' issue affects users who are trying to push images to a self-signed private Docker registry. This error occurs when Docker is unable to verify the authenticity of the certificate used by the registry, resulting in an x509: certificate signed by unknown authority error.

This issue can be frustrating for users who have successfully set up their private Docker registry but encounter this error when trying to push images. To resolve this issue, we will explore two primary fix methods that can help ignore the certificate signature error.

🛑 Root Causes of the Error

  • The 'Cannot push docker image to private registry - cert error' is primarily caused by Docker's default behavior of verifying the authenticity of certificates used by registries. When a self-signed certificate is used, Docker cannot verify its authenticity, resulting in this error.
  • Another alternative reason for this issue is that the registry's URL may not be correctly configured or may be missing the necessary configuration to bypass certificate verification.

🚀 How to Resolve This Issue

Ignoring Certificate Verification using Insecure Registry Flag

  1. Step 1: To ignore the certificate signature error, add the insecure-registries flag to the /etc/docker/daemon.json file. This will instruct Docker to bypass certificate verification for the specified registry.
  2. Step 2: Edit the /etc/docker/daemon.json file and add the following configuration: { "insecure-registries": ["hub.mydomain.com:5000"] }. Save the changes and restart the Docker service.
  3. Step 3: Verify that the insecure-registries flag has been applied by checking the Docker system info command. The registry should be listed as insecure, allowing you to push images without certificate verification issues.

Generating a Certificate Signing Request (CSR) for the Registry

  1. Step 1: An alternative fix method is to generate a Certificate Signing Request (CSR) for the registry and obtain an SSL/TLS certificate from a trusted Certificate Authority.
  2. Step 2: Generate a CSR for the registry using the OpenSSL command: openssl req -new -key /path/to/private/key -out /path/to/csr.txt. This will create a temporary certificate file.

✨ Wrapping Up

To resolve the 'Cannot push docker image to private registry - cert error', users can either ignore the certificate signature error by adding the insecure-registries flag or generate a Certificate Signing Request (CSR) and obtain an SSL/TLS certificate from a trusted Certificate Authority. By following these steps, users can successfully push images to their private Docker registry without encountering certificate verification issues.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions