1、下载docker二进制文件:
https://download.docker.com/linux/static/stable/x86_64/
2、docker镜像等文件默认保存在/var/lib/docker目录下,为防止根目录爆满,建议先在/var/lib/docker目录下挂载一个磁盘。然后新建一个docker用户。
groupadd docker
useradd -G docker docker
3、解压到 /usr/bin 目录
tar -xf docker-18.09.1.tgz
解压后会有个docker目录,里面有以下文件
containerd,containerd-shim,ctr,docker,docker-init,dockerd,runc
将docker目录下的二进制文件都复制到/usr/bin目录下
cp docker/* /usr/bin/
4、新增文件
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
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
5、启动docker服务
systemctl daemon-reload
systemctl start docker.service
systemctl enable docker.service
6、根据实际情况配置/etc/docker/daemon.json,配置后重启服务。
systemctl daemon-reload
systemctl restart docker.service