Let's start with the run
command. When running docker run ubuntu
docker will check for locally an image of ubuntu using the :latest
tag. If there is a docker you will create a container using this image, otherwise it will hold the docker pull ubuntu:latest
and then create the container.
When running the command docker pull ubuntu
it will check if there is an image of ubuntu with the tag :latest
, otherwise it will download the image. If you run docker pull
it finds a local image with the :latest
tag then it will download the image's signature (a hash in sha256) that is in DockerHub and will compare with the signature of your local image, if they are same it prints on the console something like:
status: Image is up to date for ubuntu:latest
If they are different it will download the new image and mark the old one with the tag <none>
, something like this:
Repository tag Image ID CREATED SIZE
ubuntu latest 113a43faa138 2 weeks ago 81.2MB
ubuntu <none> 452a96d81c30 7 weeks ago 79.6MB