Correct Docker Proxy Syntax 56/10356/1
authorbeierlm <mark.beierl@canonical.com>
Fri, 19 Feb 2021 14:34:57 +0000 (09:34 -0500)
committerbeierlm <mark.beierl@canonical.com>
Fri, 19 Feb 2021 14:34:57 +0000 (09:34 -0500)
Updates the syntax for managing the docker proxy so we can avoid
the rate limit issue

Change-Id: I29f9da9f7b3af57dd1614ded595d463c4ef14f9e
Signed-off-by: beierlm <mark.beierl@canonical.com>
installers/full_install_osm.sh

index f69d4c1..05bfd06 100755 (executable)
@@ -412,18 +412,18 @@ function install_docker_ce() {
         echo "Configuring docker proxy ..."
         if [ -f /etc/docker/daemon.json ]; then
             if grep -q registry-mirrors /etc/docker/daemon.json; then
-                sudo sed -Ei 's/("registry-mirrors".*\[)(.*)\]/\1\2, \"'"${DOCKER_PROXY_URL}"'\"\]/' /etc/docker/daemon.json
+                sudo sed -i "s|registry-mirrors.*|registry-mirrors\": [\"${DOCKER_PROXY_URL}\"] |" /etc/docker/daemon.json
             else
-                sudo sed -i 's/{/{\n  "registry-mirrors": [\"'"${DOCKER_PROXY_URL}"'\"]",/' /etc/docker/daemon.json
+                sudo sed -i "s|{|{\n  \"registry-mirrors\": [\"${DOCKER_PROXY_URL}\"],|" /etc/docker/daemon.json
             fi
         else
-            sudo cat << EOF > /etc/docker/daemon.json
+            sudo bash -c "cat << EOF > /etc/docker/daemon.json
 {
-  "registry-mirrors": ["${DOCKER_PROXY_URL}"]
+  \"registry-mirrors\": [\"${DOCKER_PROXY_URL}\"]
 }
-EOF
+EOF"
         fi
-       sudo systemctl daemon-reload
+        sudo systemctl daemon-reload
         sudo service docker restart
         echo "... restarted Docker service again"
     fi