There is always more to anything out there in the world, and same is the case with “docker container run” command.
From the screenshot below, look closely we are going to take the this as an example command.
The following happens during the command’s execution:
Step 1: First of all, the docker is going to look for the availability of the image “locally“.
Step 2: If the image is not found “locally“, then it checks for the image remotely, and by default, it checks on the “hub.docker.com“.
Moreover, in our case it does not find the image locally, so it pulled the “nginx:latest” image from “library/nginx” which is “nginx’s” official repository on “hub.docker.com“.
Step 3: After pulling the image, it also shows the “Digest” of the image, for the reference check below.
To learn more about docker, follow -> Learn Docker
Step 4: Lastly, after pulling the image remotely, it is going to make it run and return the “Container ID” on the terminal/console, for reference check below.
From this post, we have learned many things, one more thing to note here is that when the image is executed, what actually happens is that a layer is added on the top of recently pulled image, which is considered as an instance or container.