Reputation: 473
Does Docker Hub save historical versions of images that I push to a repository? Or does it overwrite the old version each time I push?
Context - I was told Docker Hub is similar to Github. And I know Github tracks changes to every file I make and gives me the ability to checkout old versions of files.
However, logic tells me images are (potentially) large files, so storing all the historical versions is problematic. That suggests Docker Hub overwrites the version of image it has each time I push to a repository. So it only has the latest version. Is that true?
Upvotes: 3
Views: 3842
Reputation: 1055
You can save historical version by versioning yours images using tags.
By default when you push image to registry, tag is set to default
that is overwritten everytime when you push new image without tag.
To add tags use this command
docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Example with myapp
and tag 1.0
docker tag myapp username/myapp:1.0
This is good practice to use tags when publishing images - Semantic Versioning here is helpfull.
Images could be large but in fact images are build of layers and when some layers are repeated then this layers could be cached that reduce the network traffic and space.
Upvotes: 1