An image does not exist locally with the tag: while pushing image to local registry

DockerPushLocalDocker RegistryMinikube

Docker Problem Overview


I am trying to push an image to a local registry running in minikube but get the below error:

Successfully built ee84225eb459
Successfully tagged user/apiserver:0.0.1

$ docker push localhost:5000/user/apiserver:0.0.1

The push refers to a repository [localhost:5000/user/apiserver]
An image does not exist locally with the tag: localhost:5000/user/apiserver

I have already tried starting minikube with below:

minikube start --vm-driver xhyve --insecure-registry localhost:5000
eval $(minikube docker-env)

Docker Solutions


Solution 1 - Docker

You need to tag and push the image. When tagging an image, you can use the image identifier (imageId). It is listed when showing the list of all images with docker images. Syntax and an example (using imageId) for creating a tag are:

docker tag <imageId or imageName> <hostname>:<repository-port>/<image>:<tag>
docker tag af340544ed62 example.com:18444/hello-world:mytag

Once the tag, which can be equivalent to a version, is created successfully, you can confirm its creation with docker images and issue the push with the syntax:

docker push <hostname>:<repository-port>/<image>:<tag>

There is an example for local nexus repository

Solution 2 - Docker

Successfully tagged user/apiserver:0.0.1

docker push localhost:5000/user/apiserver:0.0.1

Image tags need to include the registry name/port for you to push them anywhere other than the default registry (docker hub). So you need to tag your image as localhost:5000/user/apiserver:0.0.1 rather than user/apiserver:0.0.1. Then you'll be able to push to your local registry.

Solution 3 - Docker

I was getting the same error, which OP is referring to, googling the exact phrase brought me here, but, in my case, I was pushing it to the default/public repository (hub.docker.com) instead of the local one. But as it turns out the issue was the same

This was my local image which I created on my disk

[root@ip-172-31-22-195 centos]# docker images
REPOSITORY             TAG       IMAGE ID       CREATED        SIZE
centos                 latest    927311af2297   20 hours ago   193MB

I tagged it like this:

 docker tag centos devopskalsym:latest

then confirmed the tag being created:

[root@ip-172-31-22-195 centos]# docker images
REPOSITORY             TAG       IMAGE ID       CREATED        SIZE
devopskalsym           latest    927311af2297   20 hours ago   193MB
centos                 latest    927311af2297   20 hours ago   193MB

Since my repository on docker hub was: devopskalsym/centos7, I tried to push it:

docker push devopskalsym/centos7:latest

and got the error:

[root@ip-172-31-22-195 centos]# docker push devopskalsym/centos7:latest
The push refers to repository [docker.io/devopskalsym/centos7]
An image does not exist locally with the tag: devopskalsym/centos7

so I removed the tag with:

[root@ip-172-31-22-195 centos]# docker rmi devopskalsym
Untagged: devopskalsym:latest

then re-tagged correctly with the format mentioned by @BMitch.

docker tag centos:latest devopskalsym/centos7:latest

the format used is this: docker tag local-image:tagname new-repo:tagname

now it correctly shows the images:

[root@ip-172-31-22-195 centos]# docker images
REPOSITORY             TAG       IMAGE ID       CREATED        SIZE
devopskalsym/centos7   latest    927311af2297   20 hours ago   193MB
centos                 latest    927311af2297   20 hours ago   193MB

then pushed it again:

docker push devopskalsym/centos7:latest

and it worked

[root@ip-172-31-22-195 centos]# docker push devopskalsym/centos7:latest
The push refers to repository [docker.io/devopskalsym/centos7]
b7d51bf3d09e: Pushing [==================================>                ]    132MB/193.3MB

Note: you might need to login with docker login

Solution 4 - Docker

I had an image

trip-bot                     latest     0c9e8f0367bc   36 minutes ago   955MB

And I was getting error

> The push refers to repository [docker.io/ilkhr/trip-bot] An image does not exist locally with the tag: ilkhr/trip-bot

Solved the problem like this

$ docker tag 0c9e8f0367bc ilkhr/trip-bot:trip-bot

After that I did so

$ docker push ilkhr/trip-bot:trip-bot

Solution 5 - Docker

  1. first start with docker login with these commands:-

    docker login
    
  2. then check you image id / tag by this command

    docker images
    
  3. once you get your image id/tag then use this command to push to your dockerhub repository

    docker tag <imageId or tag> <dockerhub id>/<imagename>:<tag>
    

or for general you can use

    docker tag <imageId or tag> <hostname>:<repository-port>/<imagename>:<tag>

note replace angle brackets with your specific information

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
QuestionAmit ShahView Question on Stackoverflow
Solution 1 - DockerfgulView Answer on Stackoverflow
Solution 2 - DockerBMitchView Answer on Stackoverflow
Solution 3 - DockershabbyView Answer on Stackoverflow
Solution 4 - DockerИлья ХоришкоView Answer on Stackoverflow
Solution 5 - Dockereon greyView Answer on Stackoverflow