linux 离线安装docker

docker-ce 下载地址

很多情况下我们不能对docker进行在线安装,这时可以参照本篇博客尝试进行离线安装docker-ce

1.下载对应版本的安装包

2.解压安装包

tar -zxvf docker-XXX.tgz

3. 将解压的文件复制到指定位置

cp ./docker/* /usr/bin

4.配置docker服务的文件如下

cd /etc/systemd/system/
vim 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.205.230
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

5. 加载启动docker


chmod +x docker.service

systemctl daemon-reload

systemctl start docker

systemctl enable docker.service


6.查看版本

docker -v
dockier -info

posted @ 2024-05-31 16:38  北流鱼  阅读(201)  评论(0编辑  收藏  举报