二进制安装docker-20.10.9


二进制包下载地址:https://download.docker.com/linux/static/stable/x86_64/
 
 
#解压
tar xf docker-20.10.9.tgz 
#拷贝二进制文件
cp docker/* /usr/bin/
#创建containerd的service文件,并且启动

cat >/usr/lib/systemd/system/containerd.service <<EOF
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target
 
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerd
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=1048576
TasksMax=infinity
OOMScoreAdjust=-999
  
[Install]
WantedBy=multi-user.target
EOF

配置开启自启
 

systemctl enable --now containerd.service


准备docker的service文件

#准备docker的service文件

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 containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service
 
[Service]
Type=notify
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process
OOMScoreAdjust=-500
 
[Install]
WantedBy=multi-user.target
EOF


#准备docker的socket文件

cat > /usr/lib/systemd/system/docker.socket <<EOF
[Unit]
Description=Docker Socket for the API
  
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
 
[Install]
WantedBy=sockets.target
EOF


启动验证

#创建docker组

groupadd docker


#启动docker

systemctl enable --now docker.socket  && systemctl enable --now docker.service


#验证
docker info
创建docker配置文件

cat >/etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://bmd06omc.mirror.aliyuncs.com"]
}
EOF

重启服务
systemctl restart docker

 

posted @ 2023-02-02 16:34  智杰  阅读(186)  评论(0编辑  收藏  举报
marquee
当你的才华还撑不起你的野心的时候,你就应该静下心来学习。当你的能力还驾驭不了你的目标的时候,你就应该沉下心来历练。问问自己,想要怎样的人生