duhaime
duhaime

Reputation: 27574

Heroku: docker deploy throws unauthorized: authentication required

I'm trying to deploy a simple Flask server to Heroku using the following steps:

heroku login
heroku container:login

# create the app
heroku create myapp-name-2

# create the container with format:
# docker build -t registry.heroku.com/<app name>/<process type> .
docker build -t registry.heroku.com/myapp-name-2/web .

# push the image to the registry
docker push registry.heroku.com/myapp-name-2/web

# "release" the image
heroku container:release --app myapp-name-2 web

# open the app
heroku open --app myapp-name-2

However, the docker push step displays:

The push refers to repository [registry.heroku.com/myapp-name-2/web]
f60f7a4e2b2a: Preparing
3ff8a98d192e: Preparing
71476851914e: Preparing
013688a141bb: Preparing
f09460ef2908: Preparing
e188a7526d55: Waiting
6b0d56603c0c: Waiting
9496e71377c6: Waiting
5710e17ef032: Waiting
9546672d6b2f: Waiting
f2c194ac8a61: Waiting
2a50ea4f9e8e: Waiting
634249d50b9e: Waiting
68e35493907b: Waiting
e84b9d651af1: Waiting
unauthorized: authentication required

Does anyone know how I should authenticate? I've run the heroku login and heroku container:login steps multiple times now but must be missing something!

Upvotes: 25

Views: 8227

Answers (4)

Richard Nienaber
Richard Nienaber

Reputation: 10554

So in my case it was a permissions issue. Ensure that the user has the 'Deploy' permission in Heroku.

Upvotes: 0

Jaya S
Jaya S

Reputation: 71

docker hub login before

heroku container:login

and heroku container:push web --app app_name

heroku container:release web --app app_name

worked for me

Upvotes: 7

Noah
Noah

Reputation: 171

Yes, as the original answer points out first run

heroku container:login

But also ensure that the docker image is tagged correctly with the following naming convention:

docker tag <image> registry.heroku.com/<app>/<process-type>

<app> should exactly match your apps name in the dashboard of Heroku.

Additional information: https://devcenter.heroku.com/articles/container-registry-and-runtime#pushing-an-existing-image

Upvotes: 17

Alexandre Neukirchen
Alexandre Neukirchen

Reputation: 2783

The same error occurred to me. I just ran the command below and it worked.

heroku container:login

Upvotes: 33

Related Questions