更新docker换源
This commit is contained in:
parent
8bb59c1dee
commit
7aa7f119f4
@ -31,9 +31,7 @@ if [[ $pick == '1' ]];then
|
|||||||
declare -A img_dick
|
declare -A img_dick
|
||||||
declare -a img_number
|
declare -a img_number
|
||||||
declare img_pick=0
|
declare img_pick=0
|
||||||
img_dick['中国科技技术大学(默认)']='https://docker.mirrors.ustc.edu.cn'
|
img_dick['Daocloud(默认)']='https://docker.m.daocloud.io'
|
||||||
img_dick['阿里云']='https://registry.cn-hangzhou.aliyuncs.com'
|
|
||||||
img_dick['网易云']='http://hub-mirror.c.163.com'
|
|
||||||
|
|
||||||
for i in "${!img_dick[@]}";
|
for i in "${!img_dick[@]}";
|
||||||
do
|
do
|
||||||
@ -43,7 +41,7 @@ if [[ $pick == '1' ]];then
|
|||||||
done
|
done
|
||||||
read -p "请输入要选择的镜像,也可直接输入镜像网站:" img_pick
|
read -p "请输入要选择的镜像,也可直接输入镜像网站:" img_pick
|
||||||
if [[ -z $img_pick ]];then
|
if [[ -z $img_pick ]];then
|
||||||
declare url='https://docker.mirrors.ustc.edu.cn/'
|
declare url='https://docker.m.daocloud.io'
|
||||||
elif [[ $img_pick =~ ^[http] ]];then
|
elif [[ $img_pick =~ ^[http] ]];then
|
||||||
declare url=$img_pick
|
declare url=$img_pick
|
||||||
elif [[ ${img_pick} -le 0 || ${img_pick} -ge ${!img_dick[*]} ]];then
|
elif [[ ${img_pick} -le 0 || ${img_pick} -ge ${!img_dick[*]} ]];then
|
||||||
@ -53,7 +51,7 @@ if [[ $pick == '1' ]];then
|
|||||||
echo "输入错误"
|
echo "输入错误"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
sudo echo "\"{\"registry-mirrors\": [\"${url}\"]}" > '/etc/docker/daemon.json'
|
sudo echo "{\"registry-mirrors\": [\"${url}\"]}" > "/etc/docker/daemon.json"
|
||||||
sudo systemctl restart docker
|
sudo systemctl restart docker
|
||||||
echo "换源成功"
|
echo "换源成功"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user