Windows – Running Docker under Windows/cygwin environment

cygwin;dockerwindows

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

Best Answer

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.