title: Docker push in Jenkins - denied: requested access to the resource is denied
body: <p>So I'm trying to set up a pipeline in Jenkins to build image and push them to Docker hub.
  My credentials in Manage 'Jenkins' are called the same as "docker-hub-credentials" and seem to be used.</p>
  
  <p>It can build, but it just doesn't get through the push... Help? I've been on that for hours and I'm not sure what I' missing.</p>
  
  <p>I've already tried using docker login, but jenkins doesn't allow it.</p>
  
  <pre><code>stage('Build image') {
      /* This builds the actual image; synonymous to
       * docker build on the command line */
  
       bat 'docker build -t username/foldername:build . '    }
  
  
  stage('Push image') {
      /* Finally, we'll push the image with two tags:
      docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
          bat 'docker push username/foldername:build'
      }
  }
  </code></pre>
  
  <p>I expect the image to be pushed, but I have this instead :</p>
  
  <pre><code>The push refers to repository [docker.io/username/foldername]
  a73d7d9f4346: Preparing
  964bdfb24a54: Preparing
  1af124d739c9: Preparing
  6cffeea81e5d: Preparing
  614a79865f6d: Preparing
  612d27bb923f: Preparing
  ef68f6734aa4: Preparing
  612d27bb923f: Waiting
  ef68f6734aa4: Waiting
  denied: requested access to the resource is denied
  </code></pre>