@@ -80,16 +80,14 @@ set -e
8080
8181# Git commit from https://github.com/docker/docker-install when
8282# the script was uploaded (Should only be modified by upload job):
83- SCRIPT_COMMIT_SHA=" e5543d473431b782227f8908005543bb4389b8de "
83+ SCRIPT_COMMIT_SHA=" 711a0d41213afabc30b963f82c56e1442a3efe1c "
8484
8585# strip "v" prefix if present
8686VERSION=" ${VERSION# v} "
8787
8888# The channel to install from:
8989# * stable
9090# * test
91- # * edge (deprecated)
92- # * nightly (deprecated)
9391DEFAULT_CHANNEL_VALUE=" stable"
9492if [ -z " $CHANNEL " ]; then
9593 CHANNEL=$DEFAULT_CHANNEL_VALUE
@@ -149,10 +147,6 @@ esac
149147case " $CHANNEL " in
150148 stable|test)
151149 ;;
152- edge|nightly)
153- >&2 echo " DEPRECATED: the $CHANNEL channel has been deprecated and is no longer supported by this script."
154- exit 1
155- ;;
156150 * )
157151 >&2 echo " unknown CHANNEL '$CHANNEL ': use either stable or test."
158152 exit 1
@@ -174,12 +168,12 @@ command_exists() {
174168# version_gte 23.0 // 0 (success)
175169# version_gte 20.10 // 0 (success)
176170# version_gte 19.03 // 0 (success)
177- # version_gte 21.10 // 1 (fail)
171+ # version_gte 26.1 // 1 (fail)
178172version_gte () {
179173 if [ -z " $VERSION " ]; then
180174 return 0
181175 fi
182- eval version_compare " $VERSION " " $1 "
176+ version_compare " $VERSION " " $1 "
183177}
184178
185179# version_compare compares two version strings (either SemVer (Major.Minor.Path),
@@ -450,7 +444,7 @@ do_install() {
450444 esac
451445 ;;
452446
453- centos|rhel|sles )
447+ centos|rhel)
454448 if [ -z " $dist_version " ] && [ -r /etc/os-release ]; then
455449 dist_version=" $( . /etc/os-release && echo " $VERSION_ID " ) "
456450 fi
@@ -473,20 +467,23 @@ do_install() {
473467 # Print deprecation warnings for distro versions that recently reached EOL,
474468 # but may still be commonly used (especially LTS versions).
475469 case " $lsb_dist .$dist_version " in
476- debian.stretch|debian.jessie)
470+ centos.8|centos.7|rhel.7)
471+ deprecation_notice " $lsb_dist " " $dist_version "
472+ ;;
473+ debian.buster|debian.stretch|debian.jessie)
477474 deprecation_notice " $lsb_dist " " $dist_version "
478475 ;;
479- raspbian.stretch|raspbian.jessie)
476+ raspbian.buster|raspbian. stretch|raspbian.jessie)
480477 deprecation_notice " $lsb_dist " " $dist_version "
481478 ;;
482- ubuntu.xenial|ubuntu.trusty)
479+ ubuntu.bionic|ubuntu. xenial|ubuntu.trusty)
483480 deprecation_notice " $lsb_dist " " $dist_version "
484481 ;;
485- ubuntu.impish|ubuntu.hirsute|ubuntu.groovy|ubuntu.eoan|ubuntu.disco|ubuntu.cosmic)
482+ ubuntu.mantic|ubuntu.lunar|ubuntu.kinetic|ubuntu. impish|ubuntu.hirsute|ubuntu.groovy|ubuntu.eoan|ubuntu.disco|ubuntu.cosmic)
486483 deprecation_notice " $lsb_dist " " $dist_version "
487484 ;;
488485 fedora.* )
489- if [ " $dist_version " -lt 36 ]; then
486+ if [ " $dist_version " -lt 39 ]; then
490487 deprecation_notice " $lsb_dist " " $dist_version "
491488 fi
492489 ;;
@@ -495,22 +492,19 @@ do_install() {
495492 # Run setup for each distro accordingly
496493 case " $lsb_dist " in
497494 ubuntu|debian|raspbian)
498- pre_reqs=" apt-transport-https ca-certificates curl"
499- if ! command -v gpg > /dev/null; then
500- pre_reqs=" $pre_reqs gnupg"
501- fi
502- apt_repo=" deb [arch=$( dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] $DOWNLOAD_URL /linux/$lsb_dist $dist_version $CHANNEL "
495+ pre_reqs=" ca-certificates curl"
496+ apt_repo=" deb [arch=$( dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL /linux/$lsb_dist $dist_version $CHANNEL "
503497 (
504498 if ! is_dry_run; then
505499 set -x
506500 fi
507- $sh_c ' apt-get update -qq >/dev/null'
508- $sh_c " DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pre_reqs >/dev/null"
501+ $sh_c ' apt-get -qq update >/dev/null'
502+ $sh_c " DEBIAN_FRONTEND=noninteractive apt-get -y -qq install $pre_reqs >/dev/null"
509503 $sh_c ' install -m 0755 -d /etc/apt/keyrings'
510- $sh_c " curl -fsSL \" $DOWNLOAD_URL /linux/$lsb_dist /gpg\" | gpg --dearmor --yes - o /etc/apt/keyrings/docker.gpg "
511- $sh_c " chmod a+r /etc/apt/keyrings/docker.gpg "
504+ $sh_c " curl -fsSL \" $DOWNLOAD_URL /linux/$lsb_dist /gpg\" - o /etc/apt/keyrings/docker.asc "
505+ $sh_c " chmod a+r /etc/apt/keyrings/docker.asc "
512506 $sh_c " echo \" $apt_repo \" > /etc/apt/sources.list.d/docker.list"
513- $sh_c ' apt-get update -qq >/dev/null'
507+ $sh_c ' apt-get -qq update >/dev/null'
514508 )
515509 pkg_version=" "
516510 if [ -n " $VERSION " ]; then
@@ -552,50 +546,63 @@ do_install() {
552546 if ! is_dry_run; then
553547 set -x
554548 fi
555- $sh_c " DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pkgs >/dev/null"
549+ $sh_c " DEBIAN_FRONTEND=noninteractive apt-get -y -qq install $pkgs >/dev/null"
556550 )
557551 echo_docker_as_nonroot
558552 exit 0
559553 ;;
560554 centos|fedora|rhel)
561- if [ " $( uname -m) " != " s390x" ] && [ " $lsb_dist " = " rhel" ]; then
562- echo " Packages for RHEL are currently only available for s390x."
563- exit 1
564- fi
565- if [ " $lsb_dist " = " fedora" ]; then
566- pkg_manager=" dnf"
567- config_manager=" dnf config-manager"
568- enable_channel_flag=" --set-enabled"
569- disable_channel_flag=" --set-disabled"
570- pre_reqs=" dnf-plugins-core"
571- pkg_suffix=" fc$dist_version "
572- else
573- pkg_manager=" yum"
574- config_manager=" yum-config-manager"
575- enable_channel_flag=" --enable"
576- disable_channel_flag=" --disable"
577- pre_reqs=" yum-utils"
578- pkg_suffix=" el"
579- fi
580555 repo_file_url=" $DOWNLOAD_URL /linux/$lsb_dist /$REPO_FILE "
581556 (
582557 if ! is_dry_run; then
583558 set -x
584559 fi
585- $sh_c " $pkg_manager install -y -q $pre_reqs "
586- $sh_c " $config_manager --add-repo $repo_file_url "
560+ if command_exists dnf5; then
561+ $sh_c " dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core"
562+ $sh_c " dnf5 config-manager addrepo --save-filename=docker-ce.repo --from-repofile='$repo_file_url '"
563+
564+ if [ " $CHANNEL " != " stable" ]; then
565+ $sh_c " dnf5 config-manager setopt \" docker-ce-*.enabled=0\" "
566+ $sh_c " dnf5 config-manager setopt \" docker-ce-$CHANNEL .enabled=1\" "
567+ fi
568+ $sh_c " dnf makecache"
569+ elif command_exists dnf; then
570+ $sh_c " dnf -y -q --setopt=install_weak_deps=False install dnf-plugins-core"
571+ $sh_c " dnf config-manager --add-repo $repo_file_url "
572+
573+ if [ " $CHANNEL " != " stable" ]; then
574+ $sh_c " dnf config-manager --set-disabled \" docker-ce-*\" "
575+ $sh_c " dnf config-manager --set-enabled \" docker-ce-$CHANNEL \" "
576+ fi
577+ $sh_c " dnf makecache"
578+ else
579+ $sh_c " yum -y -q install yum-utils"
580+ $sh_c " yum-config-manager --add-repo $repo_file_url "
587581
588- if [ " $CHANNEL " != " stable" ]; then
589- $sh_c " $config_manager $disable_channel_flag 'docker-ce-*'"
590- $sh_c " $config_manager $enable_channel_flag 'docker-ce-$CHANNEL '"
582+ if [ " $CHANNEL " != " stable" ]; then
583+ $sh_c " yum-config-manager --disable \" docker-ce-*\" "
584+ $sh_c " yum-config-manager --enable \" docker-ce-$CHANNEL \" "
585+ fi
586+ $sh_c " yum makecache"
591587 fi
592- $sh_c " $pkg_manager makecache"
593588 )
594589 pkg_version=" "
590+ if command_exists dnf; then
591+ pkg_manager=" dnf"
592+ pkg_manager_flags=" -y -q --best"
593+ else
594+ pkg_manager=" yum"
595+ pkg_manager_flags=" -y -q"
596+ fi
595597 if [ -n " $VERSION " ]; then
596598 if is_dry_run; then
597599 echo " # WARNING: VERSION pinning is not supported in DRY_RUN"
598600 else
601+ if [ " $lsb_dist " = " fedora" ]; then
602+ pkg_suffix=" fc$dist_version "
603+ else
604+ pkg_suffix=" el"
605+ fi
599606 pkg_pattern=" $( echo " $VERSION " | sed ' s/-ce-/\\\\.ce.*/g' | sed ' s/-/.*/g' ) .*$pkg_suffix "
600607 search_command=" $pkg_manager list --showduplicates docker-ce | grep '$pkg_pattern ' | tail -1 | awk '{print \$ 2}'"
601608 pkg_version=" $( $sh_c " $search_command " ) "
@@ -635,7 +642,7 @@ do_install() {
635642 if ! is_dry_run; then
636643 set -x
637644 fi
638- $sh_c " $pkg_manager install -y -q $pkgs "
645+ $sh_c " $pkg_manager $pkg_manager_flags install $pkgs "
639646 )
640647 echo_docker_as_nonroot
641648 exit 0
@@ -645,12 +652,6 @@ do_install() {
645652 echo " Packages for SLES are currently only available for s390x"
646653 exit 1
647654 fi
648- if [ " $dist_version " = " 15.3" ]; then
649- sles_version=" SLE_15_SP3"
650- else
651- sles_minor_version=" ${dist_version##* .} "
652- sles_version=" 15.$sles_minor_version "
653- fi
654655 repo_file_url=" $DOWNLOAD_URL /linux/$lsb_dist /$REPO_FILE "
655656 pre_reqs=" ca-certificates curl libseccomp2 awk"
656657 (
@@ -662,13 +663,13 @@ do_install() {
662663 if ! is_dry_run; then
663664 cat >&2 << -'EOF '
664665 WARNING!!
665- openSUSE repository (https://download.opensuse.org/repositories/security:SELinux) will be enabled now.
666+ openSUSE repository (https://download.opensuse.org/repositories/security:/ SELinux) will be enabled now.
666667 Do you wish to continue?
667668 You may press Ctrl+C now to abort this script.
668669 EOF
669670 ( set -x; sleep 30 )
670671 fi
671- opensuse_repo=" https://download.opensuse.org/repositories/security:SELinux/$sles_version /security:SELinux.repo"
672+ opensuse_repo=" https://download.opensuse.org/repositories/security:/ SELinux/openSUSE_Factory /security:SELinux.repo"
672673 $sh_c " zypper addrepo $opensuse_repo "
673674 $sh_c " zypper --gpg-auto-import-keys refresh"
674675 $sh_c " zypper lr -d"
0 commit comments