Search code examples
dockergoogle-cloud-platformgoogle-container-registry

Container registry push


I am trying to push a docker image to the google cloud container registry. However I keep getting unauthorized. This is on a windows machine.

I have tried several things, first I tried setting up a publish using visual studio 2019 community. Then I finally tried the console and actually saw the error unauthorized.

Here is what I tried:

docker push us.gcr.io:443/my-project-id/mycontainer

It acts like it's going then tells me I don't have permissions

It then suggests the advanced methods of authentication which leads me to create a json key file. For simplicity sake I name the key file something easy like "keyfile.json".

I then follow the advanced instructions.

I start with this:

set /p PASS=<keyfile.json

when I hit enter, I get a command prompted and go ahead and type this:

docker login -u _json_key -p "$(cat keyfile.json)" https://us.gcr.io

I get the error: docker login requires at most 1 argument

Finally, I have discovered I can use google's repository and build tools this puts the image in the repository, but I would like to be able to upload it manually.

Any suggestions?


Solution

  • Aha! I had this problem. What you need to do is run:

    gcloud auth configure-docker

    Read this

    Basically, you need to authenticate gcloud to be able to push/pull from the gcloud directory.