Answers: <p>In case anyone else is running into this issue and can't figure it out, I fixed it by running this command:</p>
  
  <pre><code>gcloud auth activate-service-account --key-file key-file.json
  </code></pre>
  
  <p>And then ran my docker push command and it pushed through.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-06-25T18:07:59.880Z
Answers: 2019-06-25T18:07:59.880Z
Answers: Glitteropia
Body: <p>So I'm trying to push my docker image to gcr.io/docker-url, but it's not working. I've tried the documentation that Google has, but that's still failed (<a href="https://cloud.google.com/container-registry/docs/advanced-authentication#standalone_docker_credential_helper" rel="nofollow noreferrer">https://cloud.google.com/container-registry/docs/advanced-authentication#standalone_docker_credential_helper</a>). I also tried:</p>
  
  <pre><code>docker login gcr.io 
  </code></pre>
  
  <p>and </p>
  
  <pre><code>docker login us.gcr.io
  </code></pre>
  
  <p>Here's the command I run and my error:</p>
  
  <pre><code>docker push gcr.io/docker-url/jenkins/container
  The push refers to repository [gcr.io/docker-url/jenkins/container]
  d7ab52d2e8be: Pushing [==================================================&gt;]   2.56kB
  fae569eb21a4: Pushing  1.536kB
  7a20d9096c74: Pushing [====&gt;                                              ]  735.7kB/7.854MB
  a26d457fd72d: Pushing [&gt;                                                  ]  60.93kB/6.055MB
  36f2fac55108: Pushing [&gt;                                                  ]  502.8kB/49.16MB
  4cd936335289: Waiting 
  f1b5933fe4b5: Waiting 
  denied: Access denied.
  </code></pre>
  
  <p>For reference, I used the json file to login. I even tried all of the StackOverflow answers I could find, but no luck there, either.</p>
  
Comments: CC BY-SA 4.0
Comments: 2019-06-21T20:16:30.633Z
Comments: Does your user (or service account) have such permissions to write on Google Container Registry? .... I use to run the following command to authenticate for push/pull images: `docker login -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://gcr.io`
Comments: manasouza
Tags: <docker>
Title: Google Container Registry giving 'Access Denied' when trying to push Docker container
UserDisplayName: Glitteropia
ThreadText: # Google Container Registry giving 'Access Denied' when trying to push Docker container
  
  (Asked by: username_0 on 2019-06-20)
  
  So I'm trying to push my docker image to gcr.io/docker-url, but it's not working. I've tried the documentation that Google has, but that's still failed (<https://cloud.google.com/container-registry/docs/advanced-authentication#standalone_docker_credential_helper>). I also tried:
  
  ```
  docker login gcr.io 
  
  ```
  
  and
  
  ```
  docker login us.gcr.io
  
  ```
  
  Here's the command I run and my error:
  
  ```
  docker push gcr.io/docker-url/jenkins/container
  The push refers to repository [gcr.io/docker-url/jenkins/container]
  d7ab52d2e8be: Pushing [==================================================>]   2.56kB
  fae569eb21a4: Pushing  1.536kB
  7a20d9096c74: Pushing [====>                                              ]  735.7kB/7.854MB
  a26d457fd72d: Pushing [>                                                  ]  60.93kB/6.055MB
  36f2fac55108: Pushing [>                                                  ]  502.8kB/49.16MB
  4cd936335289: Waiting 
  f1b5933fe4b5: Waiting 
  denied: Access denied.
  
  ```
  
  For reference, I used the json file to login. I even tried all of the StackOverflow answers I could find, but no luck there, either.
  
  **Tags:** docker
  
  > **Comments:**
  > **username_1**: Does your user (or service account) have such permissions to write on Google Container Registry? .... I use to run the following command to authenticate for push/pull images: `docker login -u oauth2accesstoken -p "$(gcloud auth print-access-token)" https://gcr.io`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-06-25. Score: 1 | Accepted answer
  
  In case anyone else is running into this issue and can't figure it out, I fixed it by running this command:
  
  ```
  gcloud auth activate-service-account --key-file key-file.json
  
  ```
  
  And then ran my docker push command and it pushed through.
  
  
  ---
  
  