From f1a6485f7bf98887edca84fdf003a48a80a9dac8 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 22 Sep 2020 12:16:06 +0800 Subject: [PATCH] [feature] add kubectl for ubuntu --- apps/docker.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/docker.sh b/apps/docker.sh index a0be13a..01b44b1 100755 --- a/apps/docker.sh +++ b/apps/docker.sh @@ -10,6 +10,7 @@ case "$PM" in sudo apt install -y docker.io docker-compose ! which pip3 && $ROOT/python/install.sh sudo pip3 install docker-compose + sudo snap install kubectl --classic ;; pacman) sudo pacman -S --needed docker docker-compose @@ -24,8 +25,8 @@ sudo systemctl start docker # configuration sudo usermod -aG docker $USER -if [ -d /etc/docker ]; then - dj='{}' +# set mirror +if in-china && [[ -d /etc/docker ]]; then if [ -f /etc/docker/daemon.json ]; then # backup [ ! -f /etc/docker/daemon.bak.json ] && \ @@ -33,6 +34,8 @@ if [ -d /etc/docker ]; then # read dj=$(cat /etc/docker/daemon.json) fi - echo $dj | jq '. + {"registry-mirrors": ["https://izuhlbap.mirror.aliyuncs.com"]}' | sudo tee /etc/docker/daemon.json + [[ -z $dj ]] && dj='{}' + echo $dj | jq '. + {"registry-mirrors": ["https://izuhlbap.mirror.aliyuncs.com"]}' | \ + sudo tee /etc/docker/daemon.json sudo systemctl restart docker fi