美文网首页
Debian 9 国内环境下一键脚本安装Docker

Debian 9 国内环境下一键脚本安装Docker

作者: c61975976533 | 来源:发表于2018-04-19 16:48 被阅读0次

最近在学习kubernetes的架设,自然就需要安装很多Docker,但是安装操作系统、修改仓库、安装Docker这一路下来步骤太多,自己就用三脚猫功夫写了个脚本,脚本其实挺强大,我这入门的水平都可以写出可实际使用的效果。
因为技术比较入门,所以步骤非常繁琐,但实测确实有效。

#!/bin/bash
cat >/etc/apt/sources.list <<EOF
deb http://mirrors.163.com/debian/ stretch main non-free contrib
deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
EOF
apt update
apt install -y  apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg | apt-key add -
echo "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/debian stretch stable" >>/etc/apt/sources.list
apt update
apt install -y docker-ce
systemctl start docker
systemctl enable docker

就像上一篇文章一样,如果Docker.com没有被墙的话,一行shell就可以搞定。

相关文章

网友评论

      本文标题:Debian 9 国内环境下一键脚本安装Docker

      本文链接:https://www.haomeiwen.com/subject/ilnwkftx.html