1- #! /bin/bash
2- # shellcheck disable=all
1+ #! //usr/bin/env bash
32# -------------------------------------------------------------------------------------------------------------
43# Copyright (c) Microsoft Corporation. All rights reserved.
54# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
@@ -371,9 +370,7 @@ echo "Please log out and log back in to apply group changes."
371370
372371if type docker > /dev/null 2>&1 && type dockerd > /dev/null 2>&1 ; then
373372 echo " Docker / Moby CLI and Engine already installed."
374- else
375- if [ " ${USE_MOBY} " = " true" ]; then
376- if { [ " $ID " = " ubuntu" ] || [ " $ID " = " debian" ]; }; then
373+ elif [ " ${USE_MOBY} " = " true" ] && { [ " $ID " = " ubuntu" ] || [ " $ID " = " debian" ]; }; then
377374 # Install engine
378375 set +e # Handle error gracefully
379376 apt-get -y install --no-install-recommends \
@@ -391,10 +388,17 @@ else
391388 # Install compose
392389 apt-get -y install --no-install-recommends moby-compose || \
393390 err " Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture} ). Skipping."
391+ else
392+ if [ " $ID " = " ubuntu" ] || [ " $ID " = " debian" ]; then
393+ apt-get -y install --no-install-recommends docker-ce-cli${cli_version_suffix} docker-ce${engine_version_suffix}
394+ # Install compose
395+ apt-mark hold docker-ce docker-ce-cli
396+ apt-get -y install --no-install-recommends docker-compose-plugin || echo " (*) Package docker-compose-plugin (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture} ). Skipping."
397+
398+
399+ elif [ " ${USE_MOBY} " = " true" ] && { [ " $ID " = " fedora" ] || [ " $ID_LIKE " = " rhel" ]; }; then
400+ install_docker_or_moby
394401
395- elif [ " $ID " = " fedora" ] || [ " $ID_LIKE " = " rhel" ]; then
396- install_docker_or_moby
397- fi
398402 elif [ " ${USE_MOBY} " = " false" ] && { [ " $ID " = " fedora" ] || [ " $ID_LIKE " = " rhel" ]; }; then
399403
400404 # kmod package is required for modprobe
0 commit comments