下载docker二进制文件
https://download.docker.com/linux/static/stable/x86_64/docker-19.03.6.tgz
解压
tar xf docker-19.03.6.tgz
复制到/usr/local/bin
mv docker/* /usr/local/bin/
直接运行
/usr/bin/dockerd
demon模式运行,并保存日志
nohup /usr/bin/dockerd >/docker.log 2>&1 &
systemctl运行
sudo vim /usr/lib/systemd/system/docker.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| [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/local/bin/dockerd -H tcp://0.0.0.0:2371 -H unix:///var/run/docker.sock 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
|
设置权限权限为可执行
chmod +x /etc/systemd/system/docker.service
常用命令
1 2 3 4 5 6
| systemctl daemon-reload //重载配置文件 systemctl start docker //启动Docker systemctl stop docker //关闭docker systemctl restart docker //重启docker systemctl enable docker.service //设置开机自启 systemctl status docker //查看Docker状态
|
docker-compose
1 2 3
| chmod +x docker-compose mv docker-compose /usr/local/bin
|