GoogleCloudPlatform / docker-credential-gcr

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

Feature request: Add flag --config #69

Open uhinze opened 4 years ago

uhinze commented 4 years ago

Docker has a global --config flag documented here: https://docs.docker.com/engine/reference/commandline/cli/

Through this, you can define the location of config.json.

docker-credential-gcr configure-docker currently always generates the config file in ~/.docker. It would be nice to be able to modify this in the same way as in Docker.

I try to issue docker-credential-gcr configure-docker during the startup of a COS VM in GCP. It gives me an error that /root/.docker is a read-only filesystem, so I'd just like to put the file somewhere else.

dekkagaijin commented 4 years ago

The issue is that docker doesn't supply any parameters to docker-credential-gcr via the credential store API. However, you should be able to use the DOCKER_CONFIG ENV var to specify the directory containing the desired dockerconfig for both docker and docker-credential-gcr

uhinze commented 4 years ago

Thanks for responding! What I have in mind is this: docker-credential-gcr configure-docker --config /foo/bar -> writes /foo/bar/config.json docker run eu.gcr.io/my/image --config /foo/bar <- reads /foo/bar/config.json and authenticates with the helper.

dekkagaijin commented 4 years ago

Got it.

FYI only the config directory is user-configurable, config.json is hard-coded.