DOCKER - 8 While launching a container
Hello everyone and welcome to this introductory course to Docker.
In this lesson, we'll briefly talk about what's actually happening in the background when we run the docker container run command.
It is sometimes mistakenly thought that Docker only manages containers and that is its main job.
But there's a lot more going on in the background besides the containers executing commands.
When we type docker container run, in the background, it will search for the image we specified at the end of this command.
You remember when we typed nginx at the very end, it was the name of the image we wanted to run as the new container.
So it fetches that locally from the image cache. If it can't find it, it will go through Docker Hub, which is its default image remote repository.
By default, it will search for it, download it, and store it in the image cache.
So if we don't specify a version - and we didn't, we just typed nginx without specifying a version, it will choose the latest version.
Then, once it has the image and it's ready to go, a new container based on that image will be launched.
This will not make a copy of the image.
In fact, it will simply start making new layers of changes, on top of where the image left off, and that will customize the networking.
This will give it a specific virtual IP address which is in a Docker virtual network. In fact, this will open the port we specified. If we don't specify the Publish command, --publish, it won't open any ports.
Since we used the 80:80 format, we told it to take port 80 on the host and forward all that traffic to port 80 on the container. Then that container will eventually start using a command specified in the Dockerfile, which we'll also cover in the next section.
As you can see, a lot is happening in the background.
And later, we'll dive into each of these things in separate sections.
That's all for this video, but see you soon for the next one.