for-win icon indicating copy to clipboard operation
for-win copied to clipboard

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

Open JimPruitt opened this issue 8 years ago • 25 comments

  • Fresh install on Windows 10.
  • Virtual machine "Moby" created successfully in Hyper-V and is able to start successfully.
  • Tray application states "Docker is up and running!".

Expected behavior

  • Issue a "docker images" at command prompt
  • docker should return an (empty) list of images.

Actual behavior

  • Issue a "docker images" at command prompt
  • an error message is presented stating "could not read CA certificate "C:\\Users\\...\\.docker\\machine\\machines\\default\\ca.pem": open C:\Users\...\.docker\machine\machines\default\ca.pem: The system cannot find the path specified." (*note the "..." in the path is my username for my home directory)

I'd expect that the default docker-machine would automatically generate certificates in the correct location. Instead ...\.docker\machine\machines is empty.

Information

  • Diagnostic ID from "Diagnose & Feedback" in the menu. A diagnostic was uploaded with id: 922D6223-5E7B-4382-9261-2357D39E22AC/2018-02-23_09-04-38

  • host distribution and version (Windows version, build number, etc) Windows version: Windows 10 Enterprise OS Build: 14393.2035 Version: 1607

Docker Version: Version 17.12.0-ce-win47 (15139)

Steps to reproduce the behavior

  1. Download and run (elevated) "Docker for Windows Installer.exe" (MD5: 8427cee2e9ee0c2c342e0ce8747c4217 )
  2. After installation, execute "Docker for Windows" shortcut on desktop (elevated).
  3. Wait until dialog pops up saying "Docker is running!".
  4. Open PowerShell and type 'docker images'
  5. Sit and stare the the error message for a moment, and then go on a hunt for missing certificates...

JimPruitt avatar Feb 23 '18 14:02 JimPruitt

I've discovered that if I run docker-machine create --driver hyperv vm, new certs are successfully generated at 'C:\Users\...\.docker\machine\certs'. But this is a different path than what is stated in the initial error message.

Additionally, at the end of the 'vm' creation, was presented with another error message: Warning: got an invalid line error parsing /etc/os-release: Expected The system cannot find the path specified. to split by '=' char into two strings, instead got 1 strings Error creating machine: Error detecting OS: OS type not recognized

JimPruitt avatar Feb 23 '18 14:02 JimPruitt

Do you have any DOCKER environment variables that would have been interfering with the application? I had the same problem after moving from Docker Toolbox to the native app and had to just delete those environment variables to get things working.

georaldc avatar Mar 26 '18 19:03 georaldc

Thanks @georaldc . That does appear to be the case here. Great suggestion!

JimPruitt avatar Apr 13 '18 18:04 JimPruitt

what environment variables you removed @georaldc ?

Ebeid avatar Apr 18 '18 19:04 Ebeid

Just went through this myself and things seem to be working. I deleted

  • DOCKER_TLS_VERIFY
  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_TOOLBOX_INSTALL_PATH

If you have any other variables set, you probably want to delete those as well. You can experiment by opening a command window, doing one or more SET DOCKER_HOST= (or whatever variable), and then trying a docker command.

bobd-biz avatar Apr 18 '18 20:04 bobd-biz

Hit the same issue. I suspect it's come from first having Docker Toolbox installed and then later on installing Docker for Windows.

One additional thing I did to fix this issue was also uninstall Virtualbox to remove any clashes there.

The solution from @rwdietrich above fixed it for me, but took me a while to work out how to remove these variables. Here's how:

(from: https://apilevel.wordpress.com/2017/11/23/docker-for-windows-certificate-error-solution/)

  1. Go to Control Panel\All Control Panel Items\System Then click Advanced system settings, In System Properties, Go to Advanced Tab and Click Environment Variables. Delete all DOCKER_* from System/User variables.

  2. Remove DOCKER_* from command prompt or PowerShell, i used PowerShell. using following steps

[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")

leehaskings avatar Apr 27 '18 11:04 leehaskings

I removed the environment variables through UI but it didn't work. Then I had to manually set all the docker related variables to empty through command line i.e SET DOCKER_HOST= etc.

Btw this problem happened when I switched from Docker Toolbox to Native Docker for windows and tried to run docker command for the first time.

umairsarwar avatar Jun 18 '18 15:06 umairsarwar

Following up on @leehaskings for the UI solutions and @umairsarwar for the command lines, the problem was fixed for me.

Below are the plain text command lines.

SET DOCKER_CERT_PATH= $null, "User" SET DOCKER_HOST= $null, "User" SET DOCKER_MACHINE_NAME= $null, "User" SET DOCKER_TLS_VERIFY= $null, "User" SET DOCKER_TOOLBOX_INSTALL_PATH= $null, "User"

I ran into the problem after an upgrade from windows 7 pro and the use of Docker Toolbox + oracle virtual box to windows 10 pro and native docker.

a-florian-h avatar Jul 05 '18 09:07 a-florian-h

I had the same issues - I had to remove the following from the System Environment variables :- DOCKER_TLS_VERIFY DOCKER_CERT_PATH DOCKER_HOST DOCKER_TOOLBOX_INSTALL_PATH

Once I removed Docker then re-installed Docker this seems to work fine 👍

gkimpson avatar Aug 24 '18 14:08 gkimpson

For me it was also an environment variables problem. Instead of deleting them manually, just close your terminal and open it again. The variables should be gone.

jan-goebel-lendico avatar Sep 12 '18 13:09 jan-goebel-lendico

Great solution! Worked for mee to, after switching from Docker Toolbox (Win7) to Docker for Windows (Win10) on the same machine. About 4 environment variables were left and causing this problem.

Thank you!

Shaker1978 avatar Jan 10 '19 12:01 Shaker1978

This seems to occur whenever Docker Toolbox is installed prior to Installing Docker for Windows. Just delete the following environment variables: SET DOCKER_CERT_PATH SET DOCKER_HOST SET DOCKER_MACHINE_NAME SET DOCKER_TLS_VERIFY SET DOCKER_TOOLBOX_INSTALL_PATH

I've noticed not all installs have all of those and might be missing one or two (Not sure if this was caused by the user or just due to the installation though I never looked into it.) But just delete them and run docker in the cmd line and everything will be 👌.

thebadhatter avatar Jan 20 '19 14:01 thebadhatter

Running into this same issue now. You all seemed to have a work around where we can just clear out these values, but doesn't this just disable the usage of TLS? What is the secure way of dealing with this issue?

This SO answer here references documentation that specifically says it is not recommended to disable TLS: https://stackoverflow.com/questions/31176262/what-does-the-docker-tls-verify-and-docker-cert-path-variable-do

ghost avatar Feb 03 '19 22:02 ghost

Copying contents of "C:\Users\nabhu.docker\machine\certs." to "C:\Users\...\.docker\machine\machines\default\" worked for me

nabhanabdulla avatar Mar 11 '19 17:03 nabhanabdulla

In addition to the above I had to also regenerate certs docker-machine regenerate-certs default

jbelford avatar Mar 17 '19 21:03 jbelford

Simple solution for unsetting eval "$(docker-machine env -u)"

check after unset env | grep DOCKER

chandra-devs avatar May 20 '19 15:05 chandra-devs

Had the same issue, removed the DOCKER_... environment variables and everything works perfectly. I think the troubleshooter solution check for this and suggest a removal of the variables.

sz332 avatar Oct 08 '19 17:10 sz332

Hi, I also had the same problem. I have changed my DOCKER_CERT_PATH value to C:\Users\adity.docker\machine\certs. It worked fine.

aditya-bhuyan avatar Nov 10 '19 07:11 aditya-bhuyan

Note when modifying/deleting environment variables you may need to restart your terminal for changes to take effect. That's at least what I needed to do.

EnnioWolsink avatar Nov 24 '19 19:11 EnnioWolsink

Just went through this myself and things seem to be working. I deleted

  • DOCKER_TLS_VERIFY
  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_TOOLBOX_INSTALL_PATH

If you have any other variables set, you probably want to delete those as well. You can experiment by opening a command window, doing one or more SET DOCKER_HOST= (or whatever variable), and then trying a docker command.

Thanks a lot it fixed my issue.

99suresh81 avatar Feb 29 '20 08:02 99suresh81