rameshthoomu
rameshthoomu

Reputation: 1274

Is this possible to tag latest to multiple images in docker?

I have two images say "Image1" and "Image2". Now, i want to tag these two images to "latest" and then push these to images to my Docker hub public repo.

docker tag -f $OpImage namespace/reponame:latest

docker tag -f $obccaImage namespace/reponame:latest

and then

docker push namespace/reponame:latest

every time in docker hub i could see only one latest tag. Please help me. How to achieve this? Thanks!!

Upvotes: 3

Views: 4610

Answers (1)

Xiongbing Jin
Xiongbing Jin

Reputation: 12097

$ docker tag --help

Usage:  docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]

$ docker push --help

Usage:  docker push [OPTIONS] NAME[:TAG]

For example, if your image is image1, and docker repo is xyz/abc-peer, then you should use

docker tag image1 xyz/abc-peer:latest
docker login --username=xyz [email protected]
docker push xyz/abc-peer:latest

If you have multiple version of the same image, you can tag them with different tags (i.e. xyz/abc-peer:v6, xyz/abc-peer:v7, etc), but you can only have one latest in each repo. If you have two different images, they should be put in different repos.

Upvotes: 2

Related Questions