1. 程式人生 > >下載docker映象並測試

下載docker映象並測試

安裝docker(不會安裝可參考https://blog.csdn.net/github_34457546/article/details/84754644)之後下載映象

使用docker最簡單的方式莫過於從現有的容器映象開始。Docker官方網站專門有一個頁面來儲存所有可用的映象,網址是:index.docker.io。你可以通過瀏覽這個網頁來查詢你想要使用的映象,或者使用命令列的工具來檢索。

命令:docker search tutorial

[[email protected]_0_5_centos ~]# docker search tutorial
NAME                                          DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
learn/tutorial                                                                                40                   
georgeyord/reactjs-tutorial                   This is the backend of the React comment b...   5                    [OK]
microsoft/aci-tutorial-app                                                                    2                    
fiware/tutorials.tourguide-app                FIWARE Tour Guide App sample application        1                    [OK]
mhausenblas/kairosdb-tutorial                 GitHub fetcher for KairosDB tutorial            1                    [OK]
microsoft/aci-tutorial-sidecar                                                                1                    
muli/gluon-tutorials-zh                       https://github.com/mli/gluon-tutorials-zh       1                    [OK]
chris24walsh/flask-aws-tutorial               Runs a simple flask webapp demo, with the ...   1                    [OK]
starkandwayne/concourse-tutorial                                                              0                    
activeeon/par-connector-tutorial              Do the par-connector tutorial with R. The ...   0                    [OK]
fgraichen/concourse-tutorial-hello-world                                                      0                    
camphor/python-tutorial                       camphor-/python-tutorial                        0                    [OK]

等等

可以選擇learn/tutorial進行下載:docker pull learn/tutorial

下載後測試

 

在docker容器中執行hello world!

docker容器可以理解為在沙盒中執行的程序。這個沙盒包含了該程序執行所必須的資源,包括檔案系統、系統類庫、shell 環境等等。但這個沙盒預設是不會執行任何程式的。你需要在沙盒中執行一個程序來啟動某一個容器。這個程序是該容器的唯一程序,所以當該程序結束的時候,容器也會完全的停止。

docker run learn/tutorial echo "hello word"

[[email protected]

_0_5_centos ~]# docker run learn/tutorial echo "hello word"
hello word

測試成功!