title: Jenkins Pipeline Build with Docker, Google Registry, and Google Auth Plugin
body: <p>I'm building a Docker image using a Jenkins pipeline (using a pipeline script that was auto-generated by JHipster). I want to push my final docker image to the Google Container Registry.</p>
  
  <p>Here's what I've done: </p>
  
  <ol>
  <li>I've installed both the CloudBees Docker Custom Build Environment Plugin and the Google Container Registry Auth Plugin.</li>
  <li>I've set up Google auth credentials in Jenkins following instructions over <a href="https://medium.com/google-cloud/how-to-push-docker-image-to-google-container-registry-gcr-through-jenkins-job-52b9d5ce9f7f" rel="noreferrer">here</a></li>
  <li>I've configured my build step to use the Google Registry tag format, like so: <code>docker.build('us.gcr.io/[my-project-id]/[my-artifact-id]', 'target/docker')</code></li>
  <li>I've referenced the id of my Google Auth credentials in my push step: </li>
  </ol>
  
  <p>(Hm. Needs extra text line after bullets to format properly) </p>
  
  <pre><code>docker.withRegistry('https://us.gcr.io', '[my-credential-id]') {
      dockerImage.push 'latest'
  }
  </code></pre>
  
  <p>But the build fails with:</p>
  
  <pre><code>ERROR: Could not find credentials matching [my-credential-id] 
  Finished: FAILURE
  </code></pre>
  
  <p>I'm basically at the point of believing that these plugins don't work in a pipelines world, but I thought I'd ask if anyone has accomplished this and could give me some pointers.</p>