Linux离线安装Docker
Linux400
系统版本
系统版本:RedHat7.5
Docker版本: 18.06.3
下载地址:https://download.docker.com/linux/static/stable/x86_64/
服务器创建目录
mkdir -p /home/docker
拷贝安装包到服务器
scp '/c/Users/cmdhelp/Desktop/test/docker-18.06.3-ce.tgz' root@192.168.254.147:/home/docker
进入安装包路径
cd /home/docker/
创建docker用户组
sudo groupadd docker
添加当前用户到docker组
sudo gpasswd -a root docker
登录docker群组
newgrp docker
解压 安装包
tar -xvf docker-18.06.3-ce.tgz
复制解压文件
sudo cp docker/* /usr/bin/
添加服务
sudo vi /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
# 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
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.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# 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
提升权限
sudo chmod +x /etc/systemd/system/docker.service
重新加载daemon
sudo systemctl daemon-reload
设置开机启动
sudo systemctl enable docker
启动docker服务
sudo systemctl start docker