概要
依赖
Docker需要运行在 CentOS 7.X 上 (这是以CentOS为演示平台)
- 64位 操作系统
- 内核版本至少为 3.10
检查方法
代码语言:javascript复制[root@h103 ~]# hostnamectl
Static hostname: h103
Icon name: computer-vm
Chassis: vm
Machine ID: 12a02f8ee88d4b8e91d54d1390b0b275
Boot ID: 3232f3779bf34f68959ac017c214f268
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.4.4.el7.x86_64
Architecture: x86-64
[root@h103 ~]#
符合要求
Tip: CentOS 7 开始使用使用 hostnamectl 管理主机名,更为简洁方便
另外最好将系统进行升级,打上所有最新的补丁
代码语言:javascript复制[root@h103 ~]# yum update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.pubyun.com
* updates: mirrors.163.com
No packages marked for update
[root@h103 ~]#
准备工作完成
使用yum安装Docker
添加yum仓库
代码语言:javascript复制[root@h103 ~]# ll /etc/yum.repos.d/
total 28
drwxr-xr-x 2 root root 24 Jan 19 15:18 bak
-rw-r--r-- 1 root root 1664 Dec 9 17:59 CentOS-Base.repo
-rw-r--r-- 1 root root 1309 Dec 9 17:59 CentOS-CR.repo
-rw-r--r-- 1 root root 649 Dec 9 17:59 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 290 Dec 9 17:59 CentOS-fasttrack.repo
-rw-r--r-- 1 root root 630 Dec 9 17:59 CentOS-Media.repo
-rw-r--r-- 1 root root 1331 Dec 9 17:59 CentOS-Sources.repo
-rw-r--r-- 1 root root 1952 Dec 9 17:59 CentOS-Vault.repo
[root@h103 ~]# tee /etc/yum.repos.d/docker.repo <<-'EOF'
> [dockerrepo]
> name=Docker Repository
> baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
> enabled=1
> gpgcheck=1
> gpgkey=https://yum.dockerproject.org/gpg
> EOF
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
[root@h103 ~]# ll /etc/yum.repos.d/
total 32
drwxr-xr-x 2 root root 24 Jan 19 15:18 bak
-rw-r--r-- 1 root root 1664 Dec 9 17:59 CentOS-Base.repo
-rw-r--r-- 1 root root 1309 Dec 9 17:59 CentOS-CR.repo
-rw-r--r-- 1 root root 649 Dec 9 17:59 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 290 Dec 9 17:59 CentOS-fasttrack.repo
-rw-r--r-- 1 root root 630 Dec 9 17:59 CentOS-Media.repo
-rw-r--r-- 1 root root 1331 Dec 9 17:59 CentOS-Sources.repo
-rw-r--r-- 1 root root 1952 Dec 9 17:59 CentOS-Vault.repo
-rw-r--r-- 1 root root 166 Jan 19 17:12 docker.repo
[root@h103 ~]# cat /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
[root@h103 ~]#