Linux - Docker install
2021/6/9 7:21:51
本文主要是介绍Linux - Docker install,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
##################### # install docker ##################### installDocker(){ if [[ ${OS_VERSION} = "centos" ]];then COLOR="echo -e \\033[1;31m" END="\033[m" VERSION="19.03.5-3.EL7" rm -rf /etc/yum.repos.d/* wget -P /etc/yum.repos.d/ https://mirrors.aliyun.com/repo/Centos-7.repo || { ${COLOR}"BaseOS:Can't access the internet,please check your connection!"${END};exit;} wget -P /etc/yum.repos.d/ https://mirrors.aliyun.com/repo/epel-7.repo || { ${COLOR}"Epel:Can't access the internet,please check your connection!"${END};exit;} wget -P /etc/yum.repos.d/ https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo || { ${COLOR}"Docker-ce:Can't access the internet,please check your connection!"${END};exit;} yum clean all yum -y install docker-ce || { ${COLOR}"Base,Extras yum sources is unavailable, please check yum sources"${END};exit;} mkdir -p /etc/docker cat > /etc/docker/daemon.json <<EOF { "registry-mirrors": ["https://u5qp98hs.mirror.aliyuncs.com"] } EOF systemctl enable --now docker docker version && ${COLOR}"Docker install succesfully"${END} || ${COLOR}"Docker install failed"${END} else # ubuntu apt update apt -y install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" apt -y update apt -y install docker-ce systemctl enable --now docker docker version && ${COLOR}"Docker install succesfully"${END} || ${COLOR}"Docker install failed"${END} fi reboot }
这篇关于Linux - Docker install的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-19Docker-Compose容器集群化项目实战:新手入门指南
- 2024-11-19Docker镜像仓库项目实战:新手入门教程
- 2024-11-19Docker容器化部署项目实战:新手入门教程
- 2024-11-19Docker-Compose容器集群化资料入门教程
- 2024-11-19Docker镜像仓库资料详解:新手入门教程
- 2024-11-19Docker容器化部署资料:新手入门指南
- 2024-11-19Docker-Compose容器集群化教程:从入门到实践
- 2024-11-19Docker镜像仓库教程:新手入门指南
- 2024-11-19Docker容器化部署教程:初学者指南
- 2024-11-18Docker-Compose容器集群化入门教程