步骤1:下载docker
docker下载
可以在上述链接中选择合适自己的版本号下载到自己的桌面,然后通过终端连接工具xShell、SecureCRT等将下载下来的包上传到自己的linux服务器。
步骤2:安装docker
1、解压安装包
tar -xvf docker-19.03.6.tar
2、复制解压内容到/usr/bin目录
cp docker/* /usr/bin/
如果遇到提示,是否覆盖XXX,输入y即可。
3、编辑docker.service
vi /etc/systemd/system/docker.service
输入一下内容:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewall.service
Wants=network-online.target
[Service]
Type=notify
#the default is not to use systemd for cgroups because the delegay 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 process 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
4、赋权
chmod +x /etc/systemd/system/docker.service
5、生效最新配置
systemctl daemon-reload
6、启动docker
systemctl start docker.service
7、查看docker状态
systemctl status docker.service
8、验证docker版本
docker -v
9、设置自动启动
systemctl enable docker.service