Fix default installer to make local cluster pull images from docker proxy 16/13516/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 7 Jun 2023 10:53:25 +0000 (12:53 +0200)
committerbeierlm <mark.beierl@canonical.com>
Wed, 7 Jun 2023 16:53:31 +0000 (18:53 +0200)
This change also reverts previous commit bc5422cf9fd9d21d7028d445fe1982080101611a.

Change-Id: Ia72ce8677a8ebe15f15e6f79d8b158654393f93a
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
(cherry picked from commit 45331ff185461ed65a0e2bfd4d51e84327c2130b)

installers/install_docker_ce.sh

index 90035df..d3dd822 100755 (executable)
@@ -89,6 +89,14 @@ EOF"
         sudo service docker restart
         echo "... restarted Docker service again"
     fi
+
+    echo "Configuring containerd"
+    sudo mv /etc/containerd/config.toml /etc/containerd/config.toml.orig 2>/dev/null
+    sudo bash -c "containerd config default > /etc/containerd/config.toml"
+    sudo sed -i "s#\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]#\[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors\]\n        \[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"docker.io\"\]\n          endpoint = \[\"${DOCKER_PROXY_URL}\"\]\n        \[plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"registry.hub.docker.com\"]\n          endpoint = \[\"${DOCKER_PROXY_URL}\"]#" /etc/containerd/config.toml
+    sudo diff /etc/containerd/config.toml.orig /etc/containerd/config.toml
+    sudo service containerd restart
+
     [ -z "${DEBUG_INSTALL}" ] || ! echo "File: /etc/docker/daemon.json" || cat /etc/docker/daemon.json
     sg docker -c "docker version" || FATAL "Docker installation failed"
     echo "... Docker CE installation done"