Dokcer-ce安装脚本
程序员文章站
2022-04-14 10:59:28
1 #!/bin/bash 2 # coding: utf-8 3 # Copyright (c) 2018 4 set -e #返回值为0时,退出脚本 5 echo "1. 备份yum" 6 { 7 for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.re ......
安装docker
1 #!/bin/bash 2 # coding: utf-8 3 # copyright (c) 2018 4 set -e #返回值为0时,退出脚本 5 echo "1. 备份yum" 6 { 7 for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}.bak;done 8 rm -rf /etc/yum.repos.d/*.repo 9 } || { 10 echo "备份出错,请手动执行" 11 exit 1 12 } 13 14 echo "2. 获取网络yum" 15 { 16 wget -p /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/centos-7.repo >/dev/null 2>&1 17 wget -p /etc/yum.repos.d/ http://mirrors.163.com/.help/centos7-base-163.repo >/dev/null 2>&1 18 yum clean >/dev/null 2>&1 19 yum repolist >/dev/null 2>&1 20 } || { 21 echo "获取出错,请手动执行" 22 exit 1 23 } 24 25 echo "3. 安装docker-ce......" 26 { 27 yum -y install yum-utils >/dev/null 2>&1 28 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo >/dev/null 2>&1 29 yum clean >/dev/null 2>&1 30 yum repolist >/dev/null 2>&1 31 yum -y install epel-release docker-ce >/dev/null 2>&1 32 } || { 33 echo "安装出错,请手动安装" 34 exit 1 35 } 36 37 systemctl start docker >/dev/null 2>&1 38 systemctl enable docker >/dev/null 2>&1 39 40 echo "4. 添加内和参数" 41 { 42 cat <<eof>> /etc/sysctl.conf 43 net.bridge.bridge-nf-call-ip6tables = 1 44 net.bridge.bridge-nf-call-iptables = 1 45 eof 46 sysctl -p >/dev/null 2>&1 47 } 48 49 echo "5. 添加镜像加速" 50 { 51 cat <<eof>> /etc/docker/daemon.json 52 { 53 "registry-mirrors": [ 54 "https://registry.docker-cn.com" 55 ] 56 } 57 eof 58 } 59 60 systemctl daemon-reload >/dev/null 2>&1 61 systemctl restart docker >/dev/null 2>&1 62 63 rm -rf ./*.sh
推荐阅读
-
nodejs安装和配置环境的方法介绍
-
centos6怎么安装php模块
-
python-docx tables后追加内容_Mac brew安装MySQL8.0.21后忘记密码(重置密码篇)
-
linux下安装php环境变量怎么设置
-
用yum安装MySQLdb模块的步骤方法
-
mysql 开发进阶篇系列 45 xtrabackup 安装,用户权限,配置
-
如何安装并使用node版本工具gnvm(win环境)
-
windows下怎么安装node版本管理工具(nvm),怎么避坑?
-
Kubernates集群入门(1) 防火墙脚本velocityVBScriptLinq
-
MySql安装步骤图文教程及中文乱码的解决方案