u
This commit is contained in:
@@ -6,22 +6,22 @@
|
||||
# 安装自带版本 apt install docker.io && apt install docker-compose
|
||||
# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
|
||||
echo "=== Choose docker source (a: 阿里云, z: 中科大, leave blank for default):"
|
||||
echo "=== Choose docker source: <a> 阿里云, <z> 中科大, <leave blank> for default"
|
||||
read -p ">>> " DOCKER_SOURCE
|
||||
if [ "$DOCKER_SOURCE" = 'a' ]
|
||||
then
|
||||
GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg
|
||||
DOCKER_URL=http://mirrors.aliyun.com/docker-ce/linux/debian
|
||||
COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/2.12.2/
|
||||
# COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/2.20.3/
|
||||
elif [ "$DOCKER_SOURCE" = 'z' ]
|
||||
then
|
||||
GPG_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian/gpg
|
||||
DOCKER_URL=https://mirrors.ustc.edu.cn/docker-ce/linux/debian
|
||||
COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/2.12.2/
|
||||
# COMPOSE_URL=https://get.daocloud.io/docker/compose/releases/download/2.20.3/
|
||||
else
|
||||
GPG_URL=https://download.docker.com/linux/debian/gpg
|
||||
DOCKER_URL=https://download.docker.com/linux/debian
|
||||
COMPOSE_URL=https://github.com/docker/compose/releases/download/2.12.2/
|
||||
# COMPOSE_URL=https://github.com/docker/compose/releases/download/2.20.3/
|
||||
fi
|
||||
|
||||
echo Prepare environment ...
|
||||
@@ -48,37 +48,24 @@ docker compose version
|
||||
# sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
|
||||
# sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
echo "=== 配置中国加速镜像源 /etc/docker/daemon.json (d: Docker中国, t: 腾讯云, z: 中科大, leave blank for no mirror):"
|
||||
echo "=== Enter <y> to 配置中国加速镜像源 /etc/docker/daemon.json, <anything else> for no mirror:"
|
||||
read -p ">>> " DOCKER_MIRROR
|
||||
if [ ! "$DOCKER_MIRROR" ]
|
||||
if [ "$DOCKER_MIRROR" = 'y' ]
|
||||
then
|
||||
echo "--- Docker mirror is not specified."
|
||||
elif [ "$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
|
||||
echo '{ "registry-mirrors": [' > /etc/docker/daemon.json
|
||||
echo ' "https://registry.docker-cn.com",' >> /etc/docker/daemon.json
|
||||
echo ' "http://hub-mirror.c.163.com",' >> /etc/docker/daemon.json
|
||||
echo ' "https://docker.mirrors.ustc.edu.cn",' >> /etc/docker/daemon.json
|
||||
echo ' "https://mirror.ccs.tencentyun.com",' >> /etc/docker/daemon.json
|
||||
echo ' "https://ung2thfc.mirror.aliyuncs.com"' >> /etc/docker/daemon.json
|
||||
echo '] }' >> /etc/docker/daemon.json
|
||||
fi
|
||||
|
||||
echo "=== 启动docker服务?<y> for yes, <anything else> for no"
|
||||
read -p ">>> " StartDockerDaemon
|
||||
if [ "$StartDockerDaemon" = 'y' ]
|
||||
then
|
||||
# 开机启动
|
||||
sudo systemctl enable docker
|
||||
# 当前启动
|
||||
sudo systemctl start docker
|
||||
sudo systemctl enable docker # 开机启动
|
||||
sudo systemctl start docker # 当前启动
|
||||
sudo docker info # 查看状态,例如 'Registry Mirros:'
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user