docker离线安装
//下载静态包
//https://download.docker.com/linux/static/stable/
//解压tgz包到docker文件夹
tar -xzvf docker.tgz
//将docker文件复制到/usr/bin下
sudo cp docker/* /usr/bin
//编辑docker.service 文件 非root用户需要
sudo 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
# 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
------------------------------------------------------------
//给文件赋权
chmod +x /etc/systemd/system/docker.service
//重新加载daemon-reload
systemctl daemon-reload
//开启docker
systemctl start docker #启动Docker
//设置开机自启
systemctl enable docker.service #设置开机自启
常见问题:
1.启动报错,使用命令查看错误信息。
使用以下命令查看错误信息,查看错误日志信息为:/usr/bin/dockerd Permission denied,没有权限。
systemctl status docker
或
journalctl -xe
可以使用xftp6工具或者ls -l查看docker文件的权限,变更权限为 -rwxr-xr-x,才正确可以启动。
也使用以下方式进行授权,第2步。
$ chmod +x ~/docker
$ sudo cp ~/docker/* /usr/bin/
//https://download.docker.com/linux/static/stable/
//解压tgz包到docker文件夹
tar -xzvf docker.tgz
//将docker文件复制到/usr/bin下
sudo cp docker/* /usr/bin
//编辑docker.service 文件 非root用户需要
sudo 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
# 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
------------------------------------------------------------
//给文件赋权
chmod +x /etc/systemd/system/docker.service
//重新加载daemon-reload
systemctl daemon-reload
//开启docker
systemctl start docker #启动Docker
//设置开机自启
systemctl enable docker.service #设置开机自启
常见问题:
1.启动报错,使用命令查看错误信息。
使用以下命令查看错误信息,查看错误日志信息为:/usr/bin/dockerd Permission denied,没有权限。
systemctl status docker
或
journalctl -xe
可以使用xftp6工具或者ls -l查看docker文件的权限,变更权限为 -rwxr-xr-x,才正确可以启动。
也使用以下方式进行授权,第2步。
$ chmod +x ~/docker
$ sudo cp ~/docker/* /usr/bin/