How to add a docker-registry secret for Google Cloud Platform on Windows (that is, in PowerShell, not Bash)?

11/7/2018

I'm using Windows, Docker for Windows with Kubernetes enabled and PowerShell (not Bash). This is just for local testing of my Docker images and Kubernetes set up. The problem I'm having is getting access to Google's Container Registry.

I created the service account, hopefully with the right permissions but I'm not there yet. I've got the JSON file with the private key and other details. My problem is when I try to create the secret by running:

kubectl create secret docker-registry gcr-json-key --docker-server=eu.gcr.io --docker-username=_json_key --docker-password="$(cat json_credentials.json)" --docker-email=pupeno@example.com

I get this error:

error: exactly one NAME is required, got 5
See 'kubectl create secret docker-registry -h' for help and examples.

My guess is that after --docker-password=" I end up with line-feeds, quotes, etc. and that is causing the problem. Or is it something else? How am I suppose to do it? Does this work in Bash but not PowerShell?

-- pupeno
google-cloud-platform
google-container-registry
kubernetes

0 Answers