Docker daily reading: run Hello World smoothly on Win10 platform

Posted by B-truE on Wed, 09 Mar 2022 11:04:38 +0100

Docker daily review (1): run Hello World smoothly on Win10 platform

Task description

  • Docker runs smoothly in Win10
  • Successfully run docker container run Hello World
  • Understand the logic
  • Understand the difference between image and container
  • Understand the meaning of docker ps
  • Use help instructions to find the answer yourself


Installation reference of docker on Win10 Official website as well as runoob docker tutorial . It was written in great detail.

In addition, I highly recommend that you use VSCode for the following operations. Of course, you can also use your favorite platform / IDE.

Run Hello World smoothly

On the first day, let's verify that Docker can run on Win10 platform. We open VSCode and create a new terminal. Input:

docker container run hello-world

Here is the log printed by my terminal:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:97a379f4f88575512824f3b352bc03cd75e239179eea0fecc38e597b2209f49a
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:

If this command runs successfully, you will see a new image in Docker Desktop:

Understand the logic

Note the logic behind this simple instruction:

The Docker engine we run in terminal tries to find an image called hello world. Since we do not store this image locally (unable to find image 'hello world: latest' locally), the Docker engine goes to the Docker Hub to find the image named "hello world". Once found, pull it down and run it in the container. The only function of hello world is to print Hello from Docker in terminal!, Then the container stops running. (we should make clear the difference between image and container)

Let's read the log of the previous chapter again,

The difference between image and container

There are many explanations on the Internet. I think the most easy to understand is one sentence: mirror image, you can regard it as a class, and the container can be regarded as the instantiation object of the class. A class can have multiple objects. Similarly, a mirror can have multiple containers. For a more detailed description, please refer to the online interpretation.

Understand the meaning of docker ps

We can wait a few seconds and try typing in terminal

docker ps

Found nothing. Try entering again

docker ps

A container is found with the status of Exited:

CONTAINER ID   IMAGE         COMMAND    CREATED          STATUS                     PORTS   
de7691d17fb5   hello-world   "/hello"   35 minutes ago   Exited (0) 34 minutes ago  amazing_pare

Because the docker ps command can be used to list the relevant information of the Docker container. The running container is displayed by default. Although we ran hallo world, the container stopped after the program was printed. So the docker ps command displays nothing. However, docker ps -a returns all containers, including those that are not running. So there is a record at this time. Another thing to note is that in terms of function, docker ps and docker container ls are the same thing.

Using the help command

If we are interested in using the docker container run instruction, we can type docker container run --help in terminal to see more information.

Topics: Docker Container Visual Studio Code