03 - Centos7中安裝及驗(yàn)證Docker

安裝

在Centos7中安裝Docker非常簡(jiǎn)單,只需要一個(gè)命令:

yum -y install docker

而在Centos6的系統(tǒng)中安裝Docker要相對(duì)復(fù)雜一些,首先需要將系統(tǒng)內(nèi)核版本升級(jí)到3.10以上,其次需要通過(guò)使用命令yum update等升級(jí)操作系統(tǒng),具體安裝方法可參考文章《Centos 6.4中安裝Docker》。

安裝完成后需要啟動(dòng)docker服務(wù):

systemctl start docker

驗(yàn)證

安裝完成后需要驗(yàn)證docker服務(wù)是否安裝成功和是否正常啟動(dòng)。

  • 驗(yàn)證版本信息
docker version

出現(xiàn)下面信息表示docker安裝成功及正常啟動(dòng):

[root@localhost ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
 Go version:      go1.6.3
 Git commit:      cb079f6-unsupported
 Built:           Fri Sep 16 13:24:25 2016
 OS/Arch:         linux/amd64

Server:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
 Go version:      go1.6.3
 Git commit:      cb079f6-unsupported
 Built:           Fri Sep 16 13:24:25 2016
 OS/Arch:         linux/amd64
[root@localhost ~]#

如果出現(xiàn)下面信息則表示只是安裝成功而沒(méi)有正常啟動(dòng):

[root@localhost ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.14.x86_64
 Go version:      go1.6.3
 Git commit:      cb079f6-unsupported
 Built:           Fri Sep 16 13:24:25 2016
 OS/Arch:         linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

此時(shí)需要輸入命令:systemctl start docker來(lái)啟動(dòng)docker服務(wù)。

  • 啟動(dòng)容器驗(yàn)證

輸入命令:docker run hello-world

[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
c04b14da8d14: Pull complete
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for docker.io/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 Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

出現(xiàn)上面信息表示安裝成功!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • Spring Cloud為開(kāi)發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見(jiàn)模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,534評(píng)論 19 139
  • Docker — 云時(shí)代的程序分發(fā)方式 要說(shuō)最近一年云計(jì)算業(yè)界有什么大事件?Google Compute Engi...
    ahohoho閱讀 15,844評(píng)論 15 147
  • 以下原文轉(zhuǎn)載于(https://docs.docker.com/docker-for-mac/)(想找中文版的最新...
    Veekend閱讀 7,783評(píng)論 0 17
  • Ubuntu的發(fā)音 Ubuntu,源于非洲祖魯人和科薩人的語(yǔ)言,發(fā)作 oo-boon-too 的音。了解發(fā)音是有意...
    螢火蟲(chóng)de夢(mèng)閱讀 100,605評(píng)論 9 468
  • 親愛(ài)的教父,世界是很簡(jiǎn)單的,北方寒冷南方不遠(yuǎn),春天就在冬天旁邊,即便是亡命之途,逃亡也要全力以赴,對(duì)嗎?——《教父...
    花腔走板閱讀 341評(píng)論 0 0

友情鏈接更多精彩內(nèi)容