Docker public registry push fails: Repository does not exist

DockerDocker Registry

Docker Problem Overview


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.

Docker Solutions


Solution 1 - Docker

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 - Docker

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.

Solution 3 - Docker

I also encountered this error Repository does not exist: gcr.io/my-project-id/my-container when attempting to push an image to Google Container Registry.

My confusion came from a misunderstanding of Docker's definition of "repository".

> A repository is a set of Docker images. A repository can be shared by pushing it to a registry server. The different images in the repository can be labeled using tags.

When Docker says that a repository does not exist, it means that there is no image that it can find locally that is tagged with that registry.host/user-name/image-name combination.

Note: The Docker Hub registry is the default, so that part can be omitted if you are pushing there.

Steps to fix this issue:

  1. Double check what images you have available locally.

     $ docker images
     REPOSITORY              TAG     IMAGE ID      CREATED     VIRTUAL SIZE
     gcr.io/my-proj/my-typo  v1      40c2ae2dedb8  2 days ago  427.8 MB
    
  2. If there is a typo, you can run the docker tag command to fix it.

     $ docker tag gcr.io/my-proj/my-typo:v1 gcr.io/my-proj/my-cntr:v1
    
  3. Now, you should be able to push the image using the complete name, including the tag.

     $ docker push gcr.io/my-proj/my-cntr:v1
    

    Note: Use gcloud docker -- push instead of docker push if you are pushing to the Google Container Registry.

Solution 4 - Docker

If you are using Amazon AWS, before you can push your Docker images to Amazon ECR, you need to create a repository to store them in. You can create Amazon ECR repositories with the AWS Management Console, or with the AWS CLI and AWS SDKs.

To create a repository

1.) Open the Amazon ECS console at https://console.aws.amazon.com/ecs/.

2.) From the navigation bar, choose the region to create your repository in.

3.) On the Repositories page, choose Create repository.

4.) For Repository name, enter a unique name for your repository and choose Next step.

5.) Now you should be able to push to your AWS repo!

Solution 5 - Docker

You need to use the complete image name. When you don't specify the tag while building, it's latest, so you should say

docker push binarybana/fedora-dev:latest

Solution 6 - Docker

Adding to Santosh Gandhe's answer, if you want to push to specific repository rather than under your login name

docker tag ${image_name} docker.io/${login_name}/${remote_repo_name}:${image_name}
and then
docker push docker.io/${login_name}/${remote_repo_name}:${image_name}

Also, don't forget to do docker login first.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJKnightView Question on Stackoverflow
Solution 1 - DockerMahattamView Answer on Stackoverflow
Solution 2 - DockerSanthosh GandheView Answer on Stackoverflow
Solution 3 - DockerTim SwastView Answer on Stackoverflow
Solution 4 - DockerGreensterRoxView Answer on Stackoverflow
Solution 5 - DockerNathaniel WaisbrotView Answer on Stackoverflow
Solution 6 - DockerAbeView Answer on Stackoverflow