GoogleCloudPlatform / docker-credential-gcr

A Docker credential helper for GCR users
https://gcr.io
Apache License 2.0
292 stars 92 forks source link

Docker client version determination fails when Docker daemon is not available #37

Closed akx closed 4 years ago

akx commented 6 years ago

Hi!

I have a situation where I'm building a Docker image containing this utility, all configured and raring to go, and naturally the container being built can't connect to a Docker daemon. In this situation, docker-credential-gcr configure-docker warns (but does not fail)

WARNING: Unable to determine Docker version: exit status 1 Configuring docker-credential-gcr as a registry-specific helper. This is only supported by Docker client versions 1.13+ /root/.docker/config.json configured to use this credential helper for GCR registries

It looks like util.dockerClientVersionStrings should not bail out even if the retcode of the docker version --format '{{.Client.Version}}' invocation is non-zero. The output of the command, when run in a shell, is as expected (the error is printed to stderr).

17.12.1-ce
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
dekkagaijin commented 6 years ago

We've recently experienced the same issue with gcloud, as well, thanks for the report. As mentioned, configure-docker fails open, so this should only be an annoyance in practice. We check the version of the docker client for a couple reasons- a) to verify that docker is visible on the path b) to configure itself as a credential store for client versions 1.11 and 1.12.

dekkagaijin commented 6 years ago

Added more clarification to that warning, for cases like this: https://github.com/GoogleCloudPlatform/docker-credential-gcr/pull/45

I'm inclined to lean on helpful warning text more so than fancy error correction logic, since checking docker version can fail for any number of reasons which don't impact the function of the cred helper. Hopefully this updated error text will allow for users to verify that nothing's actually amiss...

tmshn commented 5 years ago

imo, all we need is client version, so we can use docker --version instead of docker version

dekkagaijin commented 4 years ago

configure-docker no longer checks the Docker client version: https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/tag/v2.0.0