Docker public registry push fails: Repository does not exist

I'm trying to push my docker image up into the public docker registry:

$ docker login
Username (binarybana): 
WARNING: login credentials saved in /home/jknight/.dockercfg.
Login Succeeded

$ docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
binarybana/dev-fedora   latest              10c7881fbaca        24 hours ago        1.148 GB
binarybana/fedoradev    latest              10c7881fbaca        24 hours ago        1.148 GB
binarybana/fedora-dev   latest              10c7881fbaca        24 hours ago        1.148 GB
<none>                  <none>              b44397dc4c99        24 hours ago        1.148 GB
<none>                  <none>              a98c27ba4738        24 hours ago        1.141 GB
<none>                  <none>              775c74a34add        24 hours ago        1.141 GB
<none>                  <none>              2be2491d2354        24 hours ago        1.141 GB
docker.io/fedora        21                  93be8052dfb8        7 days ago          241.3 MB

$ docker push binarybana/dev-fedora

Do you really want to push to public registry? [Y/n]: Y
The push refers to a repository [docker.io/binarybana/dev-fedora] (len: 0)
FATA[0001] Repository does not exist: docker.io/binarybana/dev-fedora 

$ docker push binarybana/fedora-dev

Do you really want to push to public registry? [Y/n]: Y
The push refers to a repository [docker.io/binarybana/fedora-dev] (len: 0)
FATA[0002] Repository does not exist: docker.io/binarybana/fedora-dev 

Yet, I've already created the repository (viewable here). And I've also tried to push to repository names that I haven't already created (the first try in the example above).

I think the (len: 0) has something to do with it, but I can't google it. Also I originally created the image from a dockerfile as:

docker build -t binarybana/fedora-dev .

Thanks.


Solution 1:

Always build your image with "username" and "tag"

docker build -t <username>/dev-fedora:latest .

After building push the image

docker push <username>/dev-fedora:latest

Solution 2:

if you are using docker.io ( dockerhub repo ), you need to tag it including the name docker.io in it.

docker tag ${image_id} docker.io/${login_name}/${image_name} 

and then

docker push docker.io/${login_name}/${image_name}

is OK.