How can i add Auth key from Service Account for (GCP-> Container Registry) to docker daemon.json?
Normally i write url and user:pass in base64 in docker daemon.json and docker can do pull from private registry.
How about GCP Container registry? I generated a json key and it works.
docker login -u _json_key --password-stdin https://gcr.io < credentials.json
I can login to GCP Container Registry and pull the image from it but how can i add this Key to docker daemon.json So that the docker automatically makes a pull from private repo.
Thanks.
Seems that you already choose your authentication metthod:
Choosing an authentication method
Regarding JSON Key File, Use the following guidelines to limit access to your container images:
To create a new service account and a service account key for use with Container Registry repositories only:
a. Create the service account. Replace NAME with a name for the service account.
b. Grant a role to the service account. Replace PROJECT_ID with your project ID and ROLE with the appropriate Cloud Storage role for the service account.
You can run the following command using Cloud SDK on your local machine, or in Cloud Shell.The instructions on this page use the file name keyfile.json for the key file.
Verify that permissions are correctly configured for the service account. If you are using the Compute Engine service account, you must correctly configure both permissions and access scopes.
Use the service account key as your password to authenticate with Docker.
Username is
_json_key
(NOT the name of your service account)keyfile.json
is the service account key you createdfor example:
where HOSTNAME is
gcr.io
,us.gcr.io
,eu.gcr.io
, orasia.gcr.io
.Or, for older Docker clients which don't support
--password-stdin
:where HOSTNAME is
gcr.io
,us.gcr.io
,eu.gcr.io
, orasia.gcr.io
.