1.下载安装包
提取码:11qj
2.解压安装离线包
tar -xvf docker-18.06.1-ce.tgz
将解压出来的docker文件内容移动到 /usr/bin/ 目录下
cp docker/* /usr/bin/
3.添加服务信息
在 /etc/systemd/system 目录下创建一个docker.service文件,用于注册docker服务和开机启动
vim /etc/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 --selinux-enabled=false --insecure-registry=127.0.0.1
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
给service文件设置权限
chmod 777 /etc/systemd/system/docker.service
4.配置开机自启动及启动docker
重新加载配置:
systemctl daemon-reload
设置docker为开机启动,并启动docker
systemctl enable docker.service
systemctl start docker