加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
centos7-install-docker-rpm-1903.sh 2.15 KB
一键复制 编辑 原始数据 按行查看 历史
古寒飞 提交于 2024-04-11 20:43 . 123
#!/bin/bash
############################################################################
#
# 远程执行该脚本,请在命令行中直接执行以下命令:
#
# curl -sSL https://gitee.com/tay3223/biubiubiu/raw/master/centos7-install-docker-1903-rpm.sh | /bin/bash
#
#
############################################################################
# 卸载原来旧的docker
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
# 安装依赖
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
# 添加docker的yum源
# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 安装docker
yum -y install https://osoc.oss-cn-shanghai.aliyuncs.com/bao/docker/docker-ce-19.03.9-3.el7.x86_64.rpm
# 安装compose(-I:忽略已经存在的包,强制重新安装)
# pip install -I docker-compose
# 国内加速
#curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
# 启动 && 开机启动
systemctl daemon-reload
systemctl start docker
systemctl enable docker
echo -e "开机启动添加完成...\n"
# 添加阿里云的镜像加速源
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<EOF
{
"registry-mirrors": [
"https://reg-mirror.qiniu.com",
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"http://f1361db2.m.daocloud.io"
],
"exec-opts": [
"native.cgroupdriver=systemd"
],
"bip": "192.168.99.1/24",
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "10"
}
}
EOF
systemctl restart docker
cat <<Tay
====================================
1.已设置为开机启动(√ )
2.已经启动docker服务(√ )
3.相关命令:
systemctl restart docker
systemctl start docker
systemctl enable docker
====================================
Tay
VERSION=$(docker --version)
echo -e "\n当前docker版本为\n\n${VERSION} \n"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化