tensor
tensor

Reputation: 3340

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?

Upvotes: 36

Views: 74917

Answers (8)

shieldgenerator7
shieldgenerator7

Reputation: 1736

my problem was my setup.

i was using DockerHub, but i hadnt created the repository on that site yet.

once i created the repository on that site, with the correct name, it worked fine

Upvotes: 0

Ahmadzano
Ahmadzano

Reputation: 41

You could need to use the tag --load with build command

docker build --load --tag TAG_NAME .
docker push TAG_NAME

This fixed the issue for me in gitlab ci/cd with docker 27.0.3.

Upvotes: 0

Shubham Verma
Shubham Verma

Reputation: 9933

I was facing the same error while my CICD setup in GitHub actions.

enter image description here

Here is the solution:

Provide the tag name while the docker run. Use the below command in GitHub actions:

sudo docker run -d -p 3002:3002 --name ui-container shubham_verma_repo/docker-repository:<ADD_YOUR_TAG_NAME>

ADD_YOUR_TAG_NAME should be there.

Once you update this, you will not get this error.

enter image description here

Upvotes: 0

Hitanshu Gupta
Hitanshu Gupta

Reputation: 21

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.

Upvotes: 2

Pankaj Rawat
Pankaj Rawat

Reputation: 4573

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

Upvotes: 13

seylul
seylul

Reputation: 61

The official usage is below:

docker push < IMAGENAME >:< TAGNAME >

Upvotes: 3

Oda Mitsuru
Oda Mitsuru

Reputation: 734

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

Upvotes: 6

David
David

Reputation: 1745

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

Upvotes: 43

Related Questions