Centos7离线部署docker
下载docker离线包
1 | wget https: //download .docker.com /linux/static/stable/x86_64/docker-19 .03.5.tgz |
解压
1 | tar -xvf docker-19.03.5.tgz |
将解压出来的docker目录下的文件移动到 /usr/bin/ 目录下
1 | cp docker/* /usr/bin/ |
将docker注册为系统service vim /usr/lib/systemd/system/docker.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | [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=onfailure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.target |
启动docker
1 2 3 | 启动 chmod +x /usr/lib/systemd/system/docker .service #添加文件权限并启动docker systemctl daemon-reload #重载unit配置文件 |
1 | systemctl start docker #启动Docker |
加入开机启动项
1 | ln -s /usr/lib/systemd/system/docker .service /etc/systemd/system/multi-user .target.wants /docker .service |
检查是否加入开机启动项
1 | systemctl list-unit-files| grep docker |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】