docker教程 安裝docker

docker教程 安裝

準備工作

1.centos系統
2.yum

開始安裝

更新yum

[root@localhost ~]# yum update

中途會有一個或多個確認的提示,輸入y(yes首字母)繼續。

查找docker

待更新完畢之後,查看docker的列表

[root@localhost ~]# yum list docker 

查詢的結果如下:

[root@localhost ~]# yum list docker 
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.jdcloud.com
 * extras: mirrors.aliyun.com
 * updates: mirror.jdcloud.com
可安裝的軟件包
docker.x86_64                                                       2:1.13.1-103.git7f2769b.el7.centos                                                        extras

安裝docker

我們根據docker列表選擇需要安裝的軟件包docker.x86_64進行安裝

[root@localhost ~]# yum install docker.x86_64 

安裝結果如下:

已安裝:
  docker.x86_64 2:1.13.1-103.git7f2769b.el7.centos                                                                                                                  

作爲依賴被安裝:
  PyYAML.x86_64 0:3.10-11.el7                                                            atomic-registries.x86_64 1:1.22.1-29.gitb507039.el7                       
  container-selinux.noarch 2:2.107-3.el7                                                 container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7                  
  containers-common.x86_64 1:0.1.37-3.el7.centos                                         docker-client.x86_64 2:1.13.1-103.git7f2769b.el7.centos                   
  docker-common.x86_64 2:1.13.1-103.git7f2769b.el7.centos                                libyaml.x86_64 0:0.1.4-11.el7_0                                           
  oci-register-machine.x86_64 1:0-6.git2b44233.el7                                       oci-systemd-hook.x86_64 1:0.2.0-1.git05e6923.el7_6                        
  oci-umount.x86_64 2:2.5-3.el7                                                          python-pytoml.noarch 0:0.1.14-1.git7dea353.el7                            
  subscription-manager-rhsm-certificates.x86_64 0:1.24.13-3.el7.centos                  

完畢!

啓動docker

[root@localhost ~]# systemctl start docker 

查看版本

[root@localhost ~]# docker version
[root@localhost ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7f2769b/1.13.1
 Built:           Sun Sep 15 14:06:47 2019
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7f2769b/1.13.1
 Built:           Sun Sep 15 14:06:47 2019
 OS/Arch:         linux/amd64
 Experimental:    false

測試是否可用

[root@localhost ~]# docker run hello-world:latest
[root@localhost ~]# docker run hello-world:latest
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
1b930d010525: Pull complete 
Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
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.
    (amd64)
 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:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

注意事項

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章