7

I'm not sure if this is the right community to ask about my problem as I'm actually trying to launch docker within cygwin environment on windows. After Docker Toolbox install I'm trying to launch docker version in my cygwin shell and getting:

$ docker version
Could not read CA certificate "\\cygdrive\\c\\Users\\Alexey\\.docker\\machine\\machines\\default\\ca.pem": open \cygdrive\c\Users\Alexey\.docker\machine\machines\default\ca.pem: The system cannot find the path specified.

However, the actual file /cygdrive/c/Users/Alexey/.docker/machine/machines/default/ca.pem is there, the problem seems to be in wrong slashes (windows vs UNIX) in the path to the certificate file. But I can't figure out where to fix it.

Here are the env variables set in ~/.bash_profile:

export DOCKER_HOST=tcp://192.168.99.100:2376
export DOCKER_MACHINE_NAME=default
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH=/cygdrive/c/Users/Alexey/.docker/machine/machines/default
export TERM=cygwin

UPDATE

Alexey@Alexey-PC ~
$ echo $DOCKER_CERT_PATH
/cygdrive/c/Users/Alexey/.docker/machine/machines/default/

Alexey@Alexey-PC ~
$ docker version
Could not read CA certificate "\\cygdrive\\c\\Users\\Alexey\\.docker\\machine\\machines\\default\\ca.pem": open \cygdrive\c\Users\Alexey\.docker\machine\machines\default\ca.pem: The system cannot find the path specified.

SOLUTION as proposed below by @cloverhap we need to set DOCKER_CERT_PATH environment variable, but it should contain windows path, not cygwin and moreover, the backslashes should be escaped, so the solution is to add this:

export DOCKER_CERT_PATH=C:\\Users\\%USERNAME%\\.docker\\machine\\machines\\default

to .bash_profile

  • 2
    Docker will only work in Linux as it leverages Linux kernel features (cgroups, lxc, etc). – jordanm Feb 14 '16 at 22:49
  • 1
    @jordanm: why is there windows version then? What was the point of releasing it? – Alexey Feb 15 '16 at 7:19
  • I see, they have replaced boot2docker with a system that allows the client-side docker command on Windows. The docker daemon and VMs run in a Linux virtual machine. – jordanm Feb 15 '16 at 15:12
  • probably, I'm not sure. But the question is still open: there is an issue with cygwin and directory separators in windows – Alexey Feb 15 '16 at 15:19
  • 1
    As an update for anyone coming across this question, I installed Docker on Windows 10 this week and it worked (e.g. docker version, docker run hello-world, docker run -d -p 80:80 --name webserver nginx) in Cygwin out of the box. – dimo414 Apr 4 '17 at 16:09
6
+50

On my cygwin environment the docker cert path is actually set as below and docker seems to work fine.

DOCKER_CERT_PATH=C:\Users\user\.docker\machine\machines\default

The following does indeed give an error

DOCKER_CERT_PATH=/cygdrive/c/Users/user/.docker/machine/machines/default
$ docker version
Could not read CA certificate "\\cygdrive\\c\\Users\\user\\.docker\\machine\\machines\\default\\ca.pem": open \cygdrive\c\Users\user\.docker\machine\machines\default\ca.pem: The system cannot find the path specified.

So try changing your DOCKER_CERT_PATH to regular Windows path format.

export DOCKER_CERT_PATH=C:\\Users\\Alexey\\.docker\\machine\\machines\\default

My docker version is 1.10.1, if the results are any different.

  • Thanks for your reply, but even if I try to launch it with the ENV veraible prepended to the command: DOCKER_CERT_PATH=/cygdrive/c/Users/Alexey/.docker/machine/machines/default/ docker version` it still gives me Could not read CA certificate "\\cygdrive\\c\\Users\\Alexey\\.docker\\machine\\machines\\default\\ca.pem": open \cygdrive\c\Users\Alexey\.docker\machine\machines\default\ca.pem: The system cannot find the path specified. – Alexey Feb 18 '16 at 14:48
  • The command that I wanted to point out is the first line, export DOCKER_CERT_PATH=C:\Users\user\.docker\machine\machines\default, did you try that as well? – cloverhap Feb 18 '16 at 15:17
  • yes, I also did that prior to the command I mentioned above. And AFAIK, what I did was setting env variable just for that command. See the update in my question. – Alexey Feb 18 '16 at 21:19
  • what you want to do is NOT use /cygdrive/c/Users/Alexey/.docker/machine/machines/default/ as the path, but the windows format C:\Users\Alexey\.docker\machine\machines\default – cloverhap Feb 18 '16 at 22:06
  • Thanks, it worked with a slight modification (I'm not sure why I did not notice your win-style path and used *nix and cygwin path instead). See my updated question – Alexey Feb 19 '16 at 7:14
0

I had the same problem, then I realized that when I installed docker on my Windows 10 system a program called "Docker Quickstart Terminal" was installed. If you run that if gives a bash shell and you can run your docker command in that terminal. It might not be Cygwin's bash but so what?

enter image description here

That launches this …

enter image description here

0

None of the solutions indicated here worked for me. I discovered that even using Cywin, you have to configure proxy into the GUI of Docker Desktop: enter image description here

After that I was able to run:

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pulling fs layer
1b930d010525: Verifying Checksum
1b930d010525: Download complete
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.