Centos 7.0 安装 Dcoker
1. 准备工作
官方建议Docker内核版本需大于3.8+
cat /proc/version
#Linux version 3.10.0-1062.1.2.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Mon Sep 30 14:19:46 UTC 2019
uname -a
#Linux bep7 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
uname -r
#3.10.0-1062.1.2.el7.x86_64
如已经安装Docker此操作会卸载Docker
sudo yum remove -y docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
;
# 结果如下,表示未安装过Docker
Loaded plugins: fastestmirror
No Match for argument: docker
No Match for argument: docker-client
No Match for argument: docker-client-latest
No Match for argument: docker-common
No Match for argument: docker-latest
No Match for argument: docker-latest-logrotate
No Match for argument: docker-logrotate
No Match for argument: docker-selinux
No Match for argument: docker-engine-selinux
No Match for argument: docker-engine
No Packages marked for removal
2. 安装Dokcer-1.13.1
sudo yum install -y yum-utils device-mapper-persitent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker -y
# 修改 /etc/sysconfig/docker 文件
vim /etc/sysconfig/docker
# 将--selinux-enabled设置为false,不然可能会由于selinux服务不能用导致docker启动失败
OPTIONS = '--selinux-enabled=false --log-driver=json-file --signature-verification=false'
修改systemd启动参数
# 这个启动参数是centos7自带的docker1.11.1版本需要的,会导致docker1.13.1启动失败
mv /etc/systemd/system/docker.service.d/execstart.conf /etc/systemd/system/docker.service.d/execstart.conf.cp
systemctl daemon-reload
systemctl enable docker && systemctl start docker
3. 验证安装
docker ps
docker images
docker search reids