Hello World with Docker - Running my first container
In my previous post I explained step by step procedure of installing Docker on Windows 10. We are now ready to run our first container.
In this example we will pull the hello-world image from Docker Hub and run a container.
First lets check the images already installed by following command
docker images
And it says there are no images installed
Now issue following command to run hello world container
docker run hello-world
The “Hello from Docker!” message indicates that the installation was successful.
In order to run the above container, Docker first tries to look for hello-world image locally, which doesn’t exist so it pulls the hello-world image from the Docker Hub and creates a container from that image. The container then takes care of generating and displaying the greeting on screen. Docker has also listed the steps it took to achieve the given task.
Now we should the hello-world image installed locally
Now if we run
docker run hello-world
it will not try to pull the image from Docker Hub as it is already available in local.
You have seen how easy it is to get started and take the first step by deploying a hello-world container in Docker. Try yourself and share your experience.