Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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) 
like image 999
Amit Shah Avatar asked Dec 31 '17 00:12

Amit Shah


People also ask

How do I push an image to Docker Hub?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).

How do I tag a docker image?

A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.

Do you use the docker push command to distribute an image to a registry?

Use docker image push to share your images to the Docker Hub registry or to a self-hosted one. Refer to the docker image tag reference for more information about valid image and tag names.


2 Answers

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

like image 104
fgul Avatar answered Sep 16 '22 15:09

fgul


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.

like image 35
BMitch Avatar answered Sep 17 '22 15:09

BMitch