Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging in to heroku docker registry from command line

Tags:

docker

heroku

I'm trying to log in to registory.heroku.com so that I can push my own images, but I'm having issues authenticating. If I follow the guidance from the docs, I get this:

> docker login --username=_ --password=(heroku auth:token) registry.heroku.com                                                          2077ms  Thu 29 Oct 09:15:57 2020
 ›   Warning: token will expire 05/07/2021
 ›   Use heroku authorizations:create to generate a long-term token
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded

So it wants me to use a long-term token. If I generate one using heroku authorization:create, and use the generated token as the password then the login is rejected:

) docker login --username=_ --password="this is a token" registry.heroku.com                                       1140ms  Thu 29 Oct 09:21:23 2020
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: login attempt to https://registry.heroku.com/v2/ failed with status: 401 Unauthorized

Do I need to set a scope on the long term token to get this to work? I want to use long-term tokens as the process is going to be running on CI and I want to configure it via environment variables.

like image 411
chooban Avatar asked Nov 07 '22 04:11

chooban


1 Answers

I faced the same problem, turns out I was using the id of the token not the actual token, use heroku authorizations:info <token_id> to get the token.

like image 90
Omar Mneimneh Avatar answered Nov 14 '22 22:11

Omar Mneimneh