离线安装docker
离线安装Docker
1. 二进制安装
1. 下载离线包
2. 解压
tar -zxvf docekr-xxx.tgz
3. 复制压缩后的文件到指定文件夹
cp docker/* /usr/bin
4. 注册编辑docker服务
vim /etc/systemd/system/docker.service
5. 添加可执行权限
chmod +x /etc/systemd/system/docker.service
6. 一键三连
systemctl daemon-reload
systemctl start docker
systemctl enable docker.service # 设置开机自启动
参考docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
#ExecStart=/usr/bin/dockerd --privileged=true --default-ulimit nofile=65536:65536 -H fd://
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
2. docker 卸载
1. 停掉docker服务
systemctl stop docker
2. 查看yum安装的docker文件包
yum list installed |grep docker
3. 删除所有安装的docker文件包
yum -y remove docker.x86_64
4. 查看rpm包是否还有
rpm -qa |grep docker
5. 删除docker镜像放置的位置
rm -rf /var/lib/docker