okay..till now we have pulled some official images.
You can see this from the official docker hub: https://hub.docker.com/_/nginx
Here "mainline" , "latest", "1.21" etc means all the same.
In our system, we have nginx image with latest tag.
Lets pull a nginx image with mainline tag
If you go to docker hub, you can see this :
We previously had nginx image and thus few layers where existed. Now, as we pulled mainline tag, we just had to pull few layers.
now lets check the images
Now lets create an image in docker hub using an official image
docker image tag <image to copy> <targeted image to be created>
tag is used to use the newest tag of that image of copy.
Oh! Before that, log in into your system using docker hub. SO that you can create an image and push it to docker hub.
Now, lets create our image
Check carefully, nginx & mitul3737/nginx image has the same image ID: de2543b9436b
also they have the same tag : latest
This is because mitul3737/nginx has just copied nginx image and we told it to set the same tag (latest)
now, lets push it to our dockerhub profile
docker image push < your image>
You can see that the docker hub has this one
Now, lets change the tag and of our image add another layer over it.
docker image tag <image to copy> <image where to copy>:<your_tag>
We have copied our mitul3737/nginx image and used it to create another image with tag "testing"
YOu can see the nginx, mitul3737/nginx al has same image ID but mitul3737/nginx has latest & testing tag. These means that , they are all same image. Just copy of them with different names.
Now, lets push it to our docker hub
Look carefully, the layers exists . This means that they are not re uploaded. while copying from mitul3737/nginx to mitul3737/nginx:testing, we copied everything and just gave it a new tag . Thus no new layers were added and we had nothing to uploadd.
In the docker hub:
YOu can see that, under the mitul3737/nginx image, the layers are added. So, you can use latest one using mitul3737/nginx:latest command and use the testing one using