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

如下图所示,安装成功

 

posted @ 2023-05-31 13:54  转身瞬间  阅读(724)  评论(0)    收藏  举报