From: garciadeblas Date: Wed, 7 Jun 2023 21:19:00 +0000 (+0200) Subject: Fix containerd configuration to be applied only if there is docker proxy X-Git-Tag: release-v14.0-start~25 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=1f2576e1564f1ddd7d2f0ff7627d9ef76eab9c51;p=osm%2Fdevops.git Fix containerd configuration to be applied only if there is docker proxy Change-Id: I483a916d9aa341af9184a3e549f7cf9409d4744b Signed-off-by: garciadeblas --- diff --git a/installers/install_docker_ce.sh b/installers/install_docker_ce.sh index 64c23c28..5c0cc6d3 100755 --- a/installers/install_docker_ce.sh +++ b/installers/install_docker_ce.sh @@ -90,12 +90,14 @@ EOF" 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 + if [ -n "${DOCKER_PROXY_URL}" ]; then + 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 + fi [ -z "${DEBUG_INSTALL}" ] || ! echo "File: /etc/docker/daemon.json" || cat /etc/docker/daemon.json sg docker -c "docker version" || FATAL "Docker installation failed"