How to resolve the heroku container push fail: "no basic auth credentials ▸ Error: docker push exited with Error: 1"
Once again, what worked perfectly three days ago fails today.
heroku container:login Login Succeeded
. .
docker login . . Login Succeeded
. .
heroku container:push web -a blah === Building web (/Users/.../Dockerfile) Sending build context to Docker daemon 42.85MB . . Successfully built 6c1f0a3c65c8 Successfully tagged registry.heroku.com/blah/web:latest === Pushing web (/Users/cw/../Dockerfile) The push refers to repository [registry.heroku.com/blah/web] ccbc2f4c4f90: Preparing c002d03955d7: Preparing 669a1b7e3876: Preparing 99c1e51e4548: Preparing 200d6216fb4b: Preparing 887d646f7070: Waiting c167acc9a8e9: Preparing 577d182336e4: Preparing 2147747beb86: Preparing 1591bf7ec708: Preparing dd3097cd7909: Waiting 685934357c89: Waiting ccb9b68523fd: Waiting 00bcea93703b: Waiting 688e187d6c79: Waiting no basic auth credentials ▸ Error: docker push exited with Error: 1
After a month of coding it was time to push and had the same issue - no basic auth credentials. THIS time, I think this is actually a workable answer:
From Heroku docs:
$ docker login --username=_ --password=$(heroku auth:token) registry.heroku.com
(that's a direct quote. you'd better ignore that underscore, though).
But where to get the auth:token? Apparently you just need to login to Heroku:
Running heroku login (or any other heroku command that requires authentication) creates or updates your ~/.netrc file...
...and the ~/.netrc file contains your auth:token.
Retrieve the auth:token
$ heroku auth:token ff6-blah-blah-blah-2b
SO:
$ docker login --username=blah --password=$(ff6-blah-blah-blah-2b) registry.heroku.com
But then:
bash: ff6-blah-blah-blah-2b: command not found
So perhaps there's a bug? But not to worry, you get a second chance:
Password: ff6-blah-blah-blah-2b
That's right, your auth:token, NOT your password, despite what it says, and...
Login Succeeded
Which brought happiness in this form:
The push refers to repository [registry.heroku.com/blah/web] 880ed5cb8cce: Preparing d65226c5343a: Pushed 88f6abcdc67e: Pushed b4d4668b5618: Pushed 5d7ae135e193: Pushed a844ed4bf9ae: Pushed 3b70de5cb989: Pushed c023cf8fe796: Pushed b5694bda03f5: Pushed 4b4c002ee6ca: Pushed cdc9dae211b4: Pushed 7095af798ace: Pushed fe6a4fdbedc0: Pushed e4d0e810d54a: Pushed 4e006334a6fd: Pushed latest: digest: sha256:e1 - - - d1 size: 3479