Often there are tags with images when they are pulled. If you want to rename that tag, all you need to do is the following steps.
- Pull the image
- Re-tag the image using docker tag imagename:current_tag imagename:new_tag
- docker rmi image:current_tag
When you re-tag, it will leave you with two different images with different tags and we need to get rid of the old one using step3.
An example given below
- Pull the image
[abc@host ~]$ sudo docker pull busybox:old
musl: Pulling from library/busybox
2bafa357a9a5: Pull complete
Digest: sha256:658f4fcf74879ed5a01bf310d018099413f3b2588c1565ac54c85253ba3fc6d4
Status: Downloaded newer image for busybox:old
docker.io/library/busybox:old - Verify the image
[abc@host ~]$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox old 21f6c69ffad2 2 weeks ago 1.47MB - Re-tag the image
[abc@host ~]$ sudo docker tag busybox:old busybox:new - Verify the images
[abc@host ~]$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox old 21f6c69ffad2 2 weeks ago 1.47MB
busybox new 21f6c69ffad2 2 weeks ago 1.47MB - Untag the old image by removing it
[abc@host ~]$ sudo docker rmi busybox:old
Untagged: busybox:old - Confirm only one image with latest tag alone is present
[abc@host ~]$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox new 21f6c69ffad2 2 weeks ago 1.47MB
Recent Comments