docker安装
前期检查
系统版本大于等于centos/redhat7.5,因为我们要使用overlay2的存储,具体原因,后面再说。
内核版本大于等于3.10。
[root@node7 ~]# uname -r
3.10.0-862.el7.x86_64
[root@node7 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@node7 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
添加repo仓库
这里我们选择阿里云的镜像源,速度比较快
[root@node7 ~]# cat /etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
安装
yum install -y docker-ce
配置加速器
注册阿里云账号,可以获得免费的镜像加速功能,docker-ce的配置文件为/etc/docker/daemon.json,是一个json类型的文件,通过配置该文件,我们就可以修改docker。
[root@node7 ~]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://xxxxxxxxx.mirror.aliyuncs.com"]
}
启动
[root@node7 ~]# systemctl restart docker
[root@node7 ~]# docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.5
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local ##存储插件
Network: bridge host ipvlan macvlan null overlay ##支持的网络插件
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog ##日志
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
r