简体   繁体   中英

How do you fix a docker push error, tag does not exist?

When pushing a docker image to registry, I got this message:

docker push -t domain.com/repo/tag_docker_name:latest

Error tag name does not exist

The only way is to create the tag in docker repository via web interface, and then docker push works.

Is there a command line to create docker push?

You need to add a tag to the image, here is the documentation. Use it like this docker tag 0e5574283393 domain.com/repo/tag_docker_name:latest where 0e5574283393 is the image hash

First there is no option -t for docker push command

Second assume that you already have a tagged image said repo/your_image:tag , you should follow the push syntax docker push repo/your_image:tag , docker host should not be included (in your case domain.com ) unless you want to push the image to a private repository.

A simple way to check whether the image name existed is to use docker images , which lists all images available on the host, and image name should be the same as displayed in REPOSITORY column.

Follow this link to check docker documentation

If you have not tagged your image while docker build and added tag on push, you will get this error.

In my case, I haven't tagged the image and while build but push command added tag, that is why I was getting this error. below is my correct command

docker image build -t pankajrawat333/samplewebapp:v1 .
docker image push pankajrawat333/samplewebapp:v1

官方用法如下:

docker push < IMAGENAME >:< TAGNAME >

sudo docker tag (imagename or hash)(dockerhubaccountname or id)/(repositoryname):(give the tag name like v1)

eg - sudo docker tag myimage5 hitanshug/testrep:v1

then run this command docker push hitanshug/testrep:v1, always remember the tag v1 to mention it in both commands.

And if you want to push in a private repo, then first do Docker login, give the credentials, and run all the above commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM