docker push error - requested access to the resource is denied

We recently when through this process to get our web api into docker:

Continuous Delivery with Containers

Using docker on Windows in VSTS build and release management

CI/CD DevOps pipeline for microservices using VSTS

We got the whole processing building, publishing and pushing end to end. However, when we run the build a second time (or more), we kept receiving this error: requested access to the resource is denied

If you receive this error when attempting to push to docker hub (especially if it fails at the second attempt), this is probably because you need to subscribe to a docker payment plan. Initially push to a private repository. However, if you try and push a second image to a private repository, you get an error:

denied: requested access to the resource is denied

To test if this is the reason for the error,

change the repository settings - make it public. If pushing images now works, then

  • subscribe to a payment please ($7/month for 5 repositories for example).
  • change the repository back from public back to private,
  • try pushing an image again.

It should now work as expected.