当前位置: 首页 > news >正文

【Docker】以service形式离线安装卸载的docker、compose服务

CentOS7离线卸载Docker步骤

移除开机自启

[root@CenOS-1 system]# systemctl disable docker

移除注册文件

rm -rf /etc/systemd/system/docker.service

删除相关安装目录

rm -rf $(find / -name docker)

CentOS7离线安装Docker、Compose步骤

资源地址:docker_20.10.9_docker-compose_1.24

install-docker.sh

#!/bin/sh
CURRENT_PATH=$(pwd)
DOCKER_TGZ=docker-20.10.9.tgz
chattr -i /etc/group
chattr -i /etc/gshadow
chattr -i /etc/passwd
chattr -i /etc/shadowfunction exit_script(){exit 1
}
function operate(){systemctl enable dockerdocker -v
}
var=$(uname -r)
temp=${var:0:4}
a=$(echo $temp)
b=3.10
a1=${a:0:1}
a2=${a:2:1}
a3=${a:3:1}
b1=${b:0:1}
b2=${b:2:1}
b3=${b:3:1}
temp1=`expr $a1 \* 100 - $b1 \* 100 + $a2 \* 10 - $b2 \* 10 + $a3 - $b3` 
#echo $temp1
echo -e "\033[35m ++++++++   current docker version $a   ++++++++ \033[0m"
if [ $temp1 -ge 0 ] 
thenecho -e "\033[35m ++++++++   Can be installed docker   ++++++++ \033[0m"
elseecho -e "\033[35m As the version is too low, docker requires at least 3.10 or more kernel versions to install, so docker cannot be installed temporarily \033[0m"exit_script
fi
echo -e "\033[35m ++++++++   Start installing Docker   ++++++++ \033[0m"
yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine
rm -rf /var/lib/docker
echo -e "\033[35m ++++++++   Start install -$DOCKER_TGZ ,please waiting...   ++++++++ \033[0m"
tar -xvf $CURRENT_PATH/docker/$DOCKER_TGZ -C docker
cp $CURRENT_PATH/docker/docker/* /usr/bin/
tee /etc/systemd/system/docker.service <<-'EOF'
[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.targetEOF
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload
systemctl start docker
echo -e "\033[35m ++++++++   Install success   ++++++++ \033[0m"
operate
echo -e "\033[35m ++++++++   docker restart and join the boot   ++++++++ \033[0m"
cd $CURRENT_PATH

install-docker-compose.sh

#!/bin/sh
CURRENT_PATH=$(pwd)
DC_NAME='docker-compose-Linux-x86_64'
echo 'Start install docker-compose ...'
mv $CURRENT_PATH/docker/$DC_NAME /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
echo 'Install docker-compose suceess'
docker-compose -v
http://www.lryc.cn/news/263476.html

相关文章:

  • Dubbo RPC-Redis协议
  • 展开说说:Android之常用的延时执行策略
  • Jenkins在window下配置Android打包配置
  • 云原生系列2-GitLab和Jenkins
  • xcode无线真机调试详细图文步骤
  • EasyExcel合并相同内容单元格及动态标题功能的实现
  • 【论文解读】Comparing VVC, HEVC and AV1 using Objective and Subjective Assessments
  • 动态窗口法Dynamic Window Approach在动态环境中避障
  • 2023.12.15 FineBI与kettle
  • Python tkinter 初探Toplevel控件搭建父子窗口
  • SpringCloud源码探析(十二)-基于SpringBoot开发自定义中间件
  • 基于CNN+数据增强+残差网络Resnet50的少样本高准确度猫咪种类识别—深度学习算法应用(含全部工程源码)+数据集+模型(一)
  • python实现贪吃蛇游戏
  • ios备忘录怎么导入华为 方法介绍
  • electron与cesium组件入门应用功能
  • Jenkins Docker Cloud在Linux应用开发CI中的实践
  • 502 Bad Gateway with nginx + apache + subversion + ssl
  • 【PostgreSQL内核学习(十八)—— 存储管理(存储管理的体系结构)】
  • Android的组件、布局学习
  • 【离散数学】——期末刷题题库(树其一)
  • 光模块市场分析与发展趋势预测
  • Python轴承故障诊断 (八)基于EMD-CNN-GRU并行模型的故障分类
  • 鸿蒙实现年月日十分选择框,支持年月日、月日、日、年月日时分、时分切换
  • IntelliJ IDE 插件开发 | (三)消息通知与事件监听
  • VUE小知识点
  • 深入了解常见的应用层网络协议
  • 网络爬虫 多任务采集
  • 真实并发编程问题-1.钉钉面试题
  • 基于vue+element-plus+echarts制作动态绘图页面(柱状图,饼图和折线图)
  • 2312llvm,02前端