下载二进制资源:
https://download.docker.com/linux/static/stable/x86_64/
解压tar包
tar fzvx docker-19.03.4.tgz
cp -r ./docker/* /usr/bin/
使用systemctl系统服务管理docker
vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd --graph /log/docker-data/
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
[Install]
WantedBy=multi-user.target
创建daemon.json文件
vim /etc/docker/daemon.json
{}
启动docker
systemctl daemon-reload
systemctl start docker
docker ps 出现
Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
在/etc/bashrc末尾添加完毕后使文件生效source /etc/bashrc
export DOCKER_HOST='unix:///var/run/docker.sock'