Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: could not read CA certificate

I installed Docker on Windows 10 Pro and I can't get it to work.

When I try to run hello-world I get

could not read CA certificate  

It's looking for the certificates in the machine/machines/default . However that folder didn't exist.

I created a machine called "default" (which created the above mentioned folder) but that didn't help.

Before that I created another machine called "dev" which seems to have certificates, but that doesn't seem to be helping either.

Also there are certificate files in machine/machines - I don't know if I should somehow point Docker to look in that folder (instead of machine/machines/default) ?

I'm pretty new to Docker so I might be missing something. However I've been at this all day, read the Docker documentation, tried plenty of solutions and similar answers but nothing seems to be working.

like image 375
Polina Avatar asked Apr 05 '18 19:04

Polina


People also ask

Where does Docker Look for certificates?

A custom certificate is configured by creating a directory under /etc/docker/certs.

What is update CA certificates?

update-ca-certificates is a program that updates the directory /etc/ssl/certs to hold SSL certificates and generates ca-certificates. crt, a concatenated single-file list of certificates. It reads the file /etc/ca-certificates. conf.


2 Answers

I had the same issue. The problem was, that I upgraded from Docker Toolbox to Docker for Windows. When you uninstall Docker Toolbox, the user-specific env variables get not removed. The following did the trick for me:

  1. Uninstall Docker Toolbox.
  2. Uninstall VirtualBox (You cannot use VirtualBox, as it is necessary for Docker Toolbox and Hyper-V [used by Docker for Windows] at the same time.)
  3. Remove the Docker Toolbox env variables:
    • Go to Control Panel\All Control Panel Items\System.
    • Click Advanced system settings
    • Go to Advanced Tab and click Environment Variables.
    • Delete all DOCKER_* entries from System/User variables.
      • DOCKER_TLS_VERIFY
      • DOCKER_CERT_PATH
      • DOCKER_HOST
      • DOCKER_TOOLBOX_INSTALL_PATH
  4. Remove DOCKER_* from command-prompt or PowerShell. Run these command in PowerShell:

    [Environment]::SetEnvironmentVariable("DOCKER_CERT_PATH", $null, "User")

    [Environment]::SetEnvironmentVariable("DOCKER_HOST", $null, "User")

    [Environment]::SetEnvironmentVariable("DOCKER_MACHINE_NAME", $null, "User")

    [Environment]::SetEnvironmentVariable("DOCKER_TLS_VERIFY", $null, "User")

    [Environment]::SetEnvironmentVariable("DOCKER_TOOLBOX_INSTALL_PATH", $null, "User")

  5. Restart PowerShell. (If necessary, restart system as well.)

Sources:

  • Fresh install - could not read CA certificate. The system cannot find the path specified.

  • [Docker for Windows] Certificate Error Solution

like image 105
yaya Avatar answered Oct 05 '22 17:10

yaya


Environment variables hanging around from previously (long) removed Docker Toolbox installation caused this problem with Docker Desktop (which was started ok after HyperV. Removed them all, remove these environmental variables

  • DOCKER_TLS_VERIFY
  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_TOOLBOX_INSTALL_PATH

, restart terminal, all working great now

like image 37
Aditya Gupta Avatar answered Oct 05 '22 18:10

Aditya Gupta