Kitchen
Kitchen

Reputation: 83

Docker push needs user name to push to hub

I am trying to push to docker but it says it says that authorisation is needed. I know to solve this problem i am meant to add my user name before the docker push. I have built a docker image using :

docker build -t registry.heroku.com/myapp/web .

This build an image in my docker hub. I ensure that i am logged into my docker and also ensure that i have a heroku container built and logged in.

heroku login
heroku container: login

Then when i try to do a docker push:

docker push myname/registry.heroku.com/myapp/web

i then get an error saying: An image does not exist locally with the tag: myname/registry.heroku.com/myapp/web

When I do docker images then it comes up with the image i created registry.heroku.com/myapp/web

Does anyone know what i am doing wrong?

Upvotes: 0

Views: 1319

Answers (1)

Sarath Chandra
Sarath Chandra

Reputation: 109

You have built registry.heroku.com/myapp/web image and trying to push myname/registry.heroku.com/myapp/web which definitely doesn't exist.

  • You need to push the image with the same name that you have built.

  • Heroku does not accept images with myname/registry.heroku.com/myapp/web. It should be registry.heroku.com/myapp/web

  • So try pushing the image (It is correct)

    docker push registry.heroku.com/myapp/web
    
  • myname/registry.heroku.com/myapp/web (It is Incorrect)

    • login to heroku cli
      heroku container:login
      
    • login to Heroku registry with docker and Heroku's auth token
      docker login --username=_ --password=$(heroku auth:token) registry.heroku.com
      
    • push the image
      docker push registry.heroku.com/myapp/web
      

Follow This Heroku Document on pushing images

Upvotes: 1

Related Questions