Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to re-use Docker tags on different versions?

I built, tagged and published my Docker image to Quay:

docker build -t myapp .
docker tag <imageId> quay.io/myorg/myapp:1.0.0-SNAPSHOT
docker login quay.io
docker push quay.io/myorg/myapp:1.0.0-SNAPSHOT

I then SSHed onto a Linux server and ran:

sudo docker run -it -p 8080:80 -d --name myapp:1.0.0-SNAPSHOT quay.io/myorg/myapp:1.0.0-SNAPSHOT

And it a myapp container started running nicely.

I would now like to push some changes to test non-locally (on the same Linux server) and if at all possible I'd like to re-use the same tag (1.0.0-SNAPSHOT). Can I rebuild, re-tag (using the same 1.0.0-SNAPSHOT tag) and re-publish myorg/myapp:1.0.0-SNAPSHOT to Quay and then pull + run it and have Docker pick up the changes? Or do I need to build/tag/publish a 1.0.1-SNAPSHOT (or similar) new version?

like image 852
smeeb Avatar asked Oct 26 '25 23:10

smeeb


1 Answers

You can re-use tags on different build versions. It isn't really any different than latest tag (other than latest being the default if you don't supply a tag). The main issue is to make sure you pull the actual latest version. For various reasons, your Docker client may not pick up that the remote has changed, so if want to re-use the tag and be sure you are using a specific build, you can use the sha256 hash, e.g., docker pull my/image@sha256:45b23dee08af5e43a7...

See Docker docs here.

like image 60
ldg Avatar answered Oct 28 '25 16:10

ldg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!