u
This commit is contained in:
parent
6d9f784b14
commit
004fe66c4f
31
docker-install.sh
Executable file → Normal file
31
docker-install.sh
Executable file → Normal file
@ -1,16 +1,12 @@
|
|||||||
# https://docs.docker.com/engine/install/debian/
|
# https://docs.docker.com/engine/install/debian/
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
|
|
||||||
sudo apt-get install ca-certificates curl gnupg lsb-release -y
|
|
||||||
|
|
||||||
read -p "Choose docker source (a: 阿里云, z: 中科大) >> " DOCKER_SOURCE
|
read -p "Choose docker source (a: 阿里云, z: 中科大) >> " DOCKER_SOURCE
|
||||||
if [ $DOCKER_SOURCE = 'a' ]
|
if [ $DOCKER_SOURCE = 'a' ]
|
||||||
then
|
then
|
||||||
GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg
|
GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg
|
||||||
DOCKER_URL=http://mirrors.aliyun.com/docker-ce/linux/debian
|
DOCKER_URL=http://mirrors.aliyun.com/docker-ce/linux/debian
|
||||||
COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/1.29.2/
|
COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/1.29.2/
|
||||||
elif [ $DOCKER_SOURCE = 'b' ]
|
elif [ $DOCKER_SOURCE = 'z' ]
|
||||||
then
|
then
|
||||||
GPG_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg
|
GPG_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg
|
||||||
DOCKER_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian
|
DOCKER_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian
|
||||||
@ -21,6 +17,10 @@ else
|
|||||||
COMPOSE_URL=https://github.com/docker/compose/releases/download/1.29.2/
|
COMPOSE_URL=https://github.com/docker/compose/releases/download/1.29.2/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo Prepare environment ...
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install ca-certificates curl gnupg lsb-release -y
|
||||||
|
|
||||||
echo Add Docker’s official GPG key ...
|
echo Add Docker’s official GPG key ...
|
||||||
sudo curl -fsSL $GPG_URL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
sudo curl -fsSL $GPG_URL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
|
||||||
@ -34,3 +34,24 @@ sudo apt-get install docker-ce docker-ce-cli containerd.io -y
|
|||||||
echo Install Docker-Compose ...
|
echo Install Docker-Compose ...
|
||||||
sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
|
sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
|
||||||
sudo chmod +x /usr/local/bin/docker-compose
|
sudo chmod +x /usr/local/bin/docker-compose
|
||||||
|
|
||||||
|
read -p "配置中国加速镜像源 /etc/docker/daemon.json (d: Docker中国, t: 腾讯云, z: 中科大) >> " DOCKER_MIRROR
|
||||||
|
if [ $DOCKER_MIRROR = 'd' ]
|
||||||
|
then
|
||||||
|
DOCKER_MIRROR=https://registry.docker-cn.com
|
||||||
|
elif [ $DOCKER_MIRROR = 't' ]
|
||||||
|
then
|
||||||
|
DOCKER_MIRROR=https://mirror.ccs.tencentyun.com
|
||||||
|
elif [ $DOCKER_MIRROR = 'z' ]
|
||||||
|
then
|
||||||
|
DOCKER_MIRROR=https://docker.mirrors.ustc.edu.cn
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $DOCKER_MIRROR ]
|
||||||
|
then
|
||||||
|
echo "{" | sudo tee /etc/docker/daemon.json > /dev/null
|
||||||
|
echo " \"registry-mirrors\": [" | sudo tee -a /etc/docker/daemon.json > /dev/null
|
||||||
|
echo " \"$DOCKER_MIRROR\"" | sudo tee -a /etc/docker/daemon.json > /dev/null
|
||||||
|
echo " ]" | sudo tee -a /etc/docker/daemon.json > /dev/null
|
||||||
|
echo "}" | sudo tee -a /etc/docker/daemon.json > /dev/null
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user