title: Jenkins fails to build with docker
body: <p>I'm trying to build my Maven project with Jenkins and Docker.</p>
  <p>I prepared following Jenkinsfile inside my repository.</p>
  <pre><code>pipeline {
      agent none
      stages {
          stage('3-jdk-8') {
              agent {
                  docker {
                      registryUrl 'https://registry.hub.docker.com'
                      registryCredentialsId 'docker-hub'
                      image 'maven:3-jdk-8'
                      args '-v $HOME/.m2:/root/.m2'
                      reuseNode true
                  }
              }
              steps {
                  sh 'mvnw -B clean build'
              }
          }
          stage('3-jdk-11') {
              agent {
                  docker {
                      registryUrl 'https://registry.hub.docker.com'
                      registryCredentialsId 'docker-hub'
                      image 'maven:3-jdk-11'
                      args '-v $HOME/.m2:/root/.m2'
                      reuseNode true
                  }
              }
              steps {
                  sh 'mvnw -B clean build'
              }
          }
      }
  }
  </code></pre>
  <p>When I trigger the item, I got this.</p>
  <pre><code>Started by user Jin Kwon
  Checking out git https://....git into /var/lib/jenkins/workspace/...@script to read Jenkinsfile
  Selected Git installation does not exist. Using Default
  The recommended git tool is: NONE
  using credential ...
   &gt; git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/...@script/.git # timeout=10
  Fetching changes from the remote Git repository
   &gt; git config remote.origin.url https://....git # timeout=10
  Fetching upstream changes from https://....git
   &gt; git --version # timeout=10
   &gt; git --version # 'git version 2.25.1'
  using GIT_ASKPASS to set credentials 
   &gt; git fetch --tags --force --progress -- https://....git +refs/heads/*:refs/remotes/origin/* # timeout=10
   &gt; git rev-parse origin/develop^{commit} # timeout=10
  Checking out Revision c9627132515a20c209a6e0d5f14c3779fa1eb933 (origin/develop)
   &gt; git config core.sparsecheckout # timeout=10
   &gt; git checkout -f c9627132515a20c209a6e0d5f14c3779fa1eb933 # timeout=10
  Commit message: &quot;Configure docker.registry(Url|registryCredentialId)&quot;
   &gt; git rev-list --no-walk c9627132515a20c209a6e0d5f14c3779fa1eb933 # timeout=10
  [Pipeline] Start of Pipeline
  [Pipeline] stage
  [Pipeline] { (3-jdk-8)
  [Pipeline] getContext
  [Pipeline] node
  Running on Jenkins in /var/lib/jenkins/workspace/...
  [Pipeline] {
  [Pipeline] checkout
  Selected Git installation does not exist. Using Default
  The recommended git tool is: NONE
  using credential ...
   &gt; git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/.../.git # timeout=10
  Fetching changes from the remote Git repository
   &gt; git config remote.origin.url https://....git # timeout=10
  Fetching upstream changes from https://....git
   &gt; git --version # timeout=10
   &gt; git --version # 'git version 2.25.1'
  using GIT_ASKPASS to set credentials 
   &gt; git fetch --tags --force --progress -- https://....git +refs/heads/*:refs/remotes/origin/* # timeout=10
   &gt; git rev-parse origin/develop^{commit} # timeout=10
  Checking out Revision c9627132515a20c209a6e0d5f14c3779fa1eb933 (origin/develop)
   &gt; git config core.sparsecheckout # timeout=10
   &gt; git checkout -f c9627132515a20c209a6e0d5f14c3779fa1eb933 # timeout=10
  Commit message: &quot;Configure docker.registry(Url|registryCredentialId)&quot;
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] withDockerRegistry
  Using the existing docker config file.Removing blacklisted property: auths$ docker login -u onacit -p ******** https://registry.hub.docker.com
  WARNING! Using --password via the CLI is insecure. Use --password-stdin.
  WARNING! Your password will be stored unencrypted in /var/lib/jenkins/workspace/...@tmp/950e743c-139b-4e14-93c3-b9fda206b1f4/config.json.
  Configure a credential helper to remove this warning. See
  https://docs.docker.com/engine/reference/commandline/login/#credentials-store
  
  Login Succeeded
  [Pipeline] {
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] isUnix
  [Pipeline] sh
  + docker inspect -f . maven:3-jdk-8
  
  Error: No such object: maven:3-jdk-8
  [Pipeline] isUnix
  [Pipeline] sh
  + docker inspect -f . registry.hub.docker.com/maven:3-jdk-8
  
  Error: No such object: registry.hub.docker.com/maven:3-jdk-8
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] isUnix
  [Pipeline] sh
  + docker pull registry.hub.docker.com/maven:3-jdk-8
  Error response from daemon: unauthorized: authentication required
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // withDockerRegistry
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // node
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] stage
  [Pipeline] { (3-jdk-11)
  Stage &quot;3-jdk-11&quot; skipped due to earlier failure(s)
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] End of Pipeline
  ERROR: script returned exit code 1
  Finished: FAILURE
  </code></pre>