1 準備宿主系統
準備一個 CentOS 7操作系統,具體要求如下:
- 必須是 64 位操作系統
- 建議內核在 3.8 以上
通過以下命令查看您的 CentOS 內核:
uname -r
[root@bogon registry]# uname -r
3.10.0-862.el7.x86_64
2.安裝docker
1)先升級yum源倉庫,保證下載的docker是最新的版本
yum -y update
[root@bogon registry]# yum -y update
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.nju.edu.cn
* extras: mirrors.nju.edu.cn
* updates: mirrors.aliyun.com
No packages marked for update
2)安裝docker
yum install -y docker
[root@bogon network-scripts]# yum install -y docker
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.nju.edu.cn
* extras: mirrors.nju.edu.cn
* updates: mirrors.aliyun.com
正在解決依賴關係
--> 正在檢查事務
---> 軟件包 docker.x86_64.2.1.13.1-96.gitb2f74b2.el7.centos 將被 安裝
--> 正在處理依賴關係 docker-common = 2:1.13.1-96.gitb2f74b2.el7.centos,它被軟件包 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 docker-client = 2:1.13.1-96.gitb2f74b2.el7.centos,它被軟件包 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 subscription-manager-rhsm-certificates,它被軟件包 2:docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在檢查事務
---> 軟件包 docker-client.x86_64.2.1.13.1-96.gitb2f74b2.el7.centos 將被 安裝
---> 軟件包 docker-common.x86_64.2.1.13.1-96.gitb2f74b2.el7.centos 將被 安裝
--> 正在處理依賴關係 skopeo-containers >= 1:0.1.26-2,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 oci-umount >= 2:2.3.3-3,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 oci-systemd-hook >= 1:0.1.4-9,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 oci-register-machine >= 1:0-5.13,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 container-storage-setup >= 0.9.0-1,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 container-selinux >= 2:2.51-1,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
--> 正在處理依賴關係 atomic-registries,它被軟件包 2:docker-common-1.13.1-96.gitb2f74b2.el7.centos.x86_64 需要
---> 軟件包 subscription-manager-rhsm-certificates.x86_64.0.1.21.10-3.el7.centos 將被 安裝
--> 正在檢查事務
3)啓動docker
systemctl start docker.service
4)查詢docker版本
systemctl version
5)關閉docker
systemctl stop docker
6)重啓docker
systemctl restart docker
7)查看docker狀態
systemctl status docker