A simple example Docker Hello World

an introduction
Docker allows you to run applications inside containers. Use the docker run command to run an application inside a container.
 
Second run the script
[root@localhost ~]# docker run ubuntu:15.10 /bin/echo "Hello world"
Unable to find image 'ubuntu:15.10' locally
Trying to pull repository docker.io/library/ubuntu ... 
15.10: Pulling from docker.io/library/ubuntu
7dcf5a444392: Pull complete 
759aa75f3cee: Pull complete 
3fa871dc8a2b: Pull complete 
224c42ae46e7: Pull complete 
Digest: sha256:02521a2d079595241c6793b2044f02eecf294034f31d6e235ac4b2b54ffc41f3
Hello world
 
Explanation of each parameter of the three scripts
docker: Docker binary executable.
run: Combine with the previous docker to run a container.
ubuntu:15.10 specifies the image to run. Docker first checks whether the image exists on the local host. If it does not exist, Docker will download the public image from the image repository Docker Hub.
/bin/echo "Hello world": the command to execute in the started container
The complete meaning of the above command can be explained as: Docker creates a new container with the ubuntu15.10 image, then executes bin/echo "Hello world" in the container, and finally outputs the result.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326524308&siteId=291194637