通过命令 uname -a
查看当前系统架构本次架构为x86-64,故此下载x86-64版本docker
本次安装选择20.10.9
Index of linux/static/stable/x86_64/
上传下载后的压缩包到Linux系统/opt目录,然后解压
tar -xzf docker-20.10.9.tgz
解压后得到docker目录,将docker目录里面所有移动到/usr/bin/
目录(必须)后面的配置写了绝对路径
mv docker/* /usr/bin/
vi /usr/lib/systemd/system/docker.service
内容为:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
给文件添加可执行权限并重载daemon
chmod +x /usr/lib/systemd/system/docker.service
systemctl daemon-reload
vi /etc/docker/daemon.json
#找一个阿里云的私库或其他
{
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]
}
配置后重载daemon
systemctl daemon-reload
Docker与Firewalld冲突怎么办?教你几招搞定docker网络_docker firewalld 一文中说明docker版本高于20.10.0可与firewall共存
systemctl disable firewalld
chkconfig iptables off
systemctl start docker.service
systemctl enable docker.service
systemctl status docker.service
over
https://www.leftso.com/article/2411201115194207.html