一、下载docker的二进制包
https://download.docker.com/linux/static/edge/x86_64
# wget https://download.docker.com/linux/static/edge/x86_64/docker-18.04.0-ce.tgz
二、解压拷贝
# tar -zxvf docker-17.04.0-ce.tgz
# cp ./docker/docker* /usr/bin/
三、 创建服务文件
# vim /etc/systemd/system/docker.service
服务文件内容如下(其中引用了一个环境变量文件/etc/default/docker)
##############################################
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
EnvironmentFile=-/etc/default/docker
ExecStart=/usr/bin/dockerd \
--data-root=/opt/docker_run \
--bip=172.18.0.1/16 \
-H tcp://0.0.0.0:2375 \
-H unix:///var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
[Install]
WantedBy=multi-user.target
##############################################
四、启动docker服务并设为开机自启
# systemctl daemon-reload
# systemctl start docker
# systemctl enable docker
# docker info
# docker version
五、参考
https://download.docker.com/linux/static/edge/x86_64
https://docs.docker.com/engine/reference/commandline/dockerd