Linux centos 7 离线安装docker
1.下载docker
下载地址:https://download.docker.com/linux/static/stable/
选择服务器架构
2.查看服务器架构 uname -a
3.上传下载文件到服务器并解压
tar -zxf 文件
4.拷贝docker文件值 /usr/bin
cp docker/* /usr/bin/
5.进入/etc/systemd/system/目录,并创建docker.service文件
cd /etc/systemd/system/ touch docker.service
6.编辑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 --selinux-enabled=false --insecure-registry=192.168.0.2 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
修改--insecure-registry=服务器IP
7.为docker.service文件添加执行权限
chmod 777 /etc/systemd/system/docker.service
8.重新加载配置文件 配置文件如果有修改 系统会提示
systemctl daemon-reload
9启动docker
systemctl start docker
10.设置docker开机自启
systemctl enable docker.service
11.查看docker运行状态
systemctl status docker
如下图所示,安装成功
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix