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/
posted @   dirgo  阅读(2130)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2019-09-20 [转]npm安装教程
点击右上角即可分享
微信分享提示