Search code examples
dockerherokuunauthorized

401 error when using docker push to private registry (Heroku Registry)


While following Heroku's docs for how to push a docker image to their registry, I keep running into this error:

> docker push registry.heroku.com/<MY-APP>/web                                                                                                cd
Using default tag: latest
The push refers to repository [registry.heroku.com/<MY-APP>/web]
e0d052f1dc62: Preparing 
41ec0e96eb83: Preparing 
d081ada49467: Waiting 
73c3e7ef7bc6: Waiting 
unauthorized: authentication required

I continue to get a Login Succeeded whenever I try to use docker login, so I'm not sure what the issue is.

I tried to debug using the Docker Daemon logs but those weren't helpful.


Solution

  • Turns out I was bitten by what I'd consider to be a bug with the Heroku registry that stems from a debate about how to deny the user properly when they're logged in but try to access a resource that either doesn't exist or isn't theirs so that sensitive info, like the existence of a resource, isn't exposed (check this summary if you're interested).

    TL;DR - Heroku shuold be sending a 404 but send a 401 instead - Go make the app via the UI and then try again.