安装最新版Docker
一、Yum方式安装最新版Docker
①、确保Selinux处于disabled状态
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
②、添加Yum源需要的依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
③、添加Yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum clean all
yum makecache
④、安装Docker
sudo yum install docker-ce -y
⑤、验证Docker版本
[root@harbor harbor]# docker -v
Docker version 19.03.10, build 9424aeaee9
[root@harbor harbor]#
参考连接:https://www.cnblogs.com/cqkangle/p/12172203.html
二、二进制安装Docker指定版本
①、下载指定版本Docker二进制文件
https://download.docker.com/linux/static/stable/x86_64/
docker-rootless-extras-19.03.0.tgz 2019-10-18 22:27:50 17.9 MiB
docker-rootless-extras-19.03.1.tgz 2019-10-18 22:27:50 17.9 MiB
docker-rootless-extras-19.03.10.tgz 2020-05-29 03:38:28 18.4 MiB
docker-rootless-extras-19.03.2.tgz 2019-10-18 22:27:51 17.9 MiB
docker-rootless-extras-19.03.3.tgz 2019-10-18 22:27:51 17.9 MiB
docker-rootless-extras-19.03.4.tgz 2019-10-19 01:09:59 17.9 MiB
docker-rootless-extras-19.03.5.tgz 2019-11-14 18:26:01 17.9 MiB
docker-rootless-extras-19.03.6.tgz 2020-03-03 04:24:33 17.9 MiB
docker-rootless-extras-19.03.7.tgz 2020-03-04 05:39:10 17.9 MiB
docker-rootless-extras-19.03.8.tgz 2020-03-11 19:47:56 17.9 MiB
docker-rootless-extras-19.03.9.tgz 2020-05-18 22:37:48 18.3 MiB
这里安装19.03.10
wget https://download.docker.com/linux/static/stable/x86_64/docker-rootless-extras-19.03.10.tgz
tar xzvf docker-rootless-extras-19.03.10.tgz
②、复制解压后的代码到/usr/bin 目录下
cp -ar docker/* /usr/bin/
③、创建Docker服务
cat >>/usr/lib/systemd/system/docker.service <<EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF
④、设置开机启动并启动Docker
systemctl daemon-reload
systemctl start docker.service
参考网址:https://www.cnblogs.com/Dev0ps/p/10993921.html