From d08fb9ebee921b2a3654f719b405a5afb0522124 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 13:24:00 +0200 Subject: [PATCH 01/13] fix version-compare for non-CalVer versions The script strips leading zeros to accommodate CalVer versions, which led to an empty when passing a SemVer(ish) version: VERSION=23.0.0 ./install.sh --dry-run ... ./install.sh: 118: [: Illegal number: Signed-off-by: Sebastiaan van Stijn --- install.sh | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index 70ed8705..f5b98475 100755 --- a/install.sh +++ b/install.sh @@ -75,14 +75,15 @@ command_exists() { command -v "$@" > /dev/null 2>&1 } -# version_gte checks if the version specified in $VERSION is at least -# the given CalVer (YY.MM) version. returns 0 (success) if $VERSION is either -# unset (=latest) or newer or equal than the specified version. Returns 1 (fail) -# otherwise. +# version_gte checks if the version specified in $VERSION is at least the given +# SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success) +# if $VERSION is either unset (=latest) or newer or equal than the specified +# version, or returns 1 (fail) otherwise. # # examples: # -# VERSION=20.10 +# VERSION=23.0 +# version_gte 23.0 // 0 (success) # version_gte 20.10 // 0 (success) # version_gte 19.03 // 0 (success) # version_gte 21.10 // 1 (fail) @@ -90,19 +91,22 @@ version_gte() { if [ -z "$VERSION" ]; then return 0 fi - eval calver_compare "$VERSION" "$1" + eval version_compare "$VERSION" "$1" } -# calver_compare compares two CalVer (YY.MM) version strings. returns 0 (success) -# if version A is newer or equal than version B, or 1 (fail) otherwise. Patch -# releases and pre-release (-alpha/-beta) are not taken into account +# version_compare compares two version strings (either SemVer (Major.Minor.Path), +# or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer +# or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release +# (-alpha/-beta) are not taken into account # # examples: # -# calver_compare 20.10 19.03 // 0 (success) -# calver_compare 20.10 20.10 // 0 (success) -# calver_compare 19.03 20.10 // 1 (fail) -calver_compare() ( +# version_compare 23.0.0 20.10 // 0 (success) +# version_compare 23.0 20.10 // 0 (success) +# version_compare 20.10 19.03 // 0 (success) +# version_compare 20.10 20.10 // 0 (success) +# version_compare 19.03 20.10 // 1 (fail) +version_compare() ( set +x yy_a="$(echo "$1" | cut -d'.' -f1)" @@ -115,7 +119,12 @@ calver_compare() ( fi mm_a="$(echo "$1" | cut -d'.' -f2)" mm_b="$(echo "$2" | cut -d'.' -f2)" - if [ "${mm_a#0}" -lt "${mm_b#0}" ]; then + + # trim leading zeros to accommodate CalVer + mm_a="${mm_a#0}" + mm_b="${mm_b#0}" + + if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then return 1 fi From 092c8db70ab9576e3ce198b7cdfe9d9332e76ce0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 13:27:38 +0200 Subject: [PATCH 02/13] fix Docker Desktop URL to prevent redirect The URL was missing a trailing slash, which would cause a redirect: curl -I -s https://www.docker.com/products/docker-desktop | grep location: location: https://www.docker.com/products/docker-desktop/ Signed-off-by: Sebastiaan van Stijn --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index f5b98475..82ed2ed6 100755 --- a/install.sh +++ b/install.sh @@ -321,7 +321,7 @@ do_install() { if is_wsl; then echo echo "WSL DETECTED: We recommend using Docker Desktop for Windows." - echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop" + echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop/" echo cat >&2 <<-'EOF' From 24bb4ae8a0b10f990ad4dfe9fa1c15061df8f478 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 13:53:20 +0200 Subject: [PATCH 03/13] do not recursively chmod /etc/apt/keyrings This step in the installation script was added to take non-standard umasks into account (which is sometimes the case on some cloud providers). The existing command was changing modes a bit too eagerly, as it recursively set the "execute" bit, which would not only affect the /etc/apt/keyrings directory, but also any file inside it (including files we don't own); mkdir -m 0700 keyrings touch keyrings/one.sh touch keyrings/docker.gpg ls -al keyrings/ total 8 drwx------ 4 root root 128 May 7 11:43 . drwx------ 17 root root 544 May 7 11:43 .. -rw-r--r-- 1 root root 0 May 7 11:43 docker.gpg -rw-r--r-- 1 root root 0 May 7 11:43 one.sh chmod -R a+rx keyrings ls -al keyrings/ total 0 drwxr-xr-x 4 root root 128 May 7 11:43 . drwx------ 17 root root 544 May 7 11:43 .. -rwxr-xr-x 1 root root 0 May 7 11:43 docker.gpg -rwxr-xr-x 1 root root 0 May 7 11:43 one.sh This patch changes the script to use `install`, which creates the directory if it doesn't exist, and sets the permissions on the directory itself, without recursing to files inside it: mkdir -m 0700 keyrings2 touch keyrings2/one.sh touch keyrings2/docker.gpg ls -al keyrings2/ total 8 drwx------ 2 root root 4096 May 7 11:44 . drwxr-xr-x 1 root root 4096 May 7 11:44 .. -rw-r--r-- 1 root root 0 May 7 11:44 docker.gpg -rw-r--r-- 1 root root 0 May 7 11:44 one.sh install -m 0755 -d keyrings2/ total 8 drwxr-xr-x 2 root root 4096 May 7 11:44 . drwxr-xr-x 1 root root 4096 May 7 11:44 .. -rw-r--r-- 1 root root 0 May 7 11:44 docker.gpg -rw-r--r-- 1 root root 0 May 7 11:44 one.sh Changing permissions of the `docker.gpg` file itself is already handled separately through `chmod a+r /etc/apt/keyrings/docker.gpg`. Signed-off-by: Sebastiaan van Stijn --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 82ed2ed6..080f1912 100755 --- a/install.sh +++ b/install.sh @@ -415,7 +415,7 @@ do_install() { fi $sh_c 'apt-get update -qq >/dev/null' $sh_c "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pre_reqs >/dev/null" - $sh_c 'mkdir -p /etc/apt/keyrings && chmod -R 0755 /etc/apt/keyrings' + $sh_c 'install -m 0755 -d /etc/apt/keyrings' $sh_c "curl -fsSL \"$DOWNLOAD_URL/linux/$lsb_dist/gpg\" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg" $sh_c "chmod a+r /etc/apt/keyrings/docker.gpg" $sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list" From 766b70c5be1a000e09a159aedd0d2375dee84ded Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 13:59:59 +0200 Subject: [PATCH 04/13] prevent globbing when enabling/disabling rpm channels I ran into this when I ran the script from within `/etc/yum.repos.d`: + sh -c 'dnf config-manager --set-disabled docker-ce-*' Error: No matching repo to modify: docker-ce-staging.repo. Took me a bit to understand why the script was failing, and then realized the shell was expanding `docker-ce-*` to filenames in my current directory; ls -l docker-ce-* -rw-r--r--. 1 root root 2027 May 6 09:32 docker-ce-staging.repo This patch quotes the channel name to prevent globbing. Signed-off-by: Sebastiaan van Stijn --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 080f1912..f262b705 100755 --- a/install.sh +++ b/install.sh @@ -495,8 +495,8 @@ do_install() { $sh_c "$config_manager --add-repo $repo_file_url" if [ "$CHANNEL" != "stable" ]; then - $sh_c "$config_manager $disable_channel_flag docker-ce-*" - $sh_c "$config_manager $enable_channel_flag docker-ce-$CHANNEL" + $sh_c "$config_manager $disable_channel_flag 'docker-ce-*'" + $sh_c "$config_manager $enable_channel_flag 'docker-ce-$CHANNEL'" fi $sh_c "$pkg_manager makecache" ) From 804ce01aca9f60080ece774ec2f7b0cb7a0e3fe9 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 14:08:16 +0200 Subject: [PATCH 05/13] use single-quotes for sed regex-patterns While I haven't found cases where this caused issues, it probably doesn't hurt to use single-quotes for these to prevent globbing. Signed-off-by: Sebastiaan van Stijn --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index f262b705..e26b1afa 100755 --- a/install.sh +++ b/install.sh @@ -427,7 +427,7 @@ do_install() { echo "# WARNING: VERSION pinning is not supported in DRY_RUN" else # Will work for incomplete versions IE (17.12), but may not actually grab the "latest" if in the test channel - pkg_pattern="$(echo "$VERSION" | sed "s/-ce-/~ce~.*/g" | sed "s/-/.*/g")" + pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/~ce~.*/g' | sed 's/-/.*/g')" search_command="apt-cache madison 'docker-ce' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" pkg_version="$($sh_c "$search_command")" echo "INFO: Searching repository for VERSION '$VERSION'" @@ -505,7 +505,7 @@ do_install() { if is_dry_run; then echo "# WARNING: VERSION pinning is not supported in DRY_RUN" else - pkg_pattern="$(echo "$VERSION" | sed "s/-ce-/\\\\.ce.*/g" | sed "s/-/.*/g").*$pkg_suffix" + pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/\\\\.ce.*/g' | sed 's/-/.*/g').*$pkg_suffix" search_command="$pkg_manager list --showduplicates 'docker-ce' | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" pkg_version="$($sh_c "$search_command")" echo "INFO: Searching repository for VERSION '$VERSION'" @@ -587,7 +587,7 @@ do_install() { if is_dry_run; then echo "# WARNING: VERSION pinning is not supported in DRY_RUN" else - pkg_pattern="$(echo "$VERSION" | sed "s/-ce-/\\\\.ce.*/g" | sed "s/-/.*/g")" + pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/\\\\.ce.*/g' | sed 's/-/.*/g')" search_command="zypper search -s --match-exact 'docker-ce' | grep '$pkg_pattern' | tail -1 | awk '{print \$6}'" pkg_version="$($sh_c "$search_command")" echo "INFO: Searching repository for VERSION '$VERSION'" From 379e81609ea7b14a000502d9c40807a53d30a3dd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 14:50:06 +0200 Subject: [PATCH 06/13] SLES: move opensuse_repo variable closer to where it's used It's only used in a single location, so move it there Signed-off-by: Sebastiaan van Stijn --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index e26b1afa..8560c674 100755 --- a/install.sh +++ b/install.sh @@ -560,7 +560,6 @@ do_install() { sles_minor_version="${dist_version##*.}" sles_version="15.$sles_minor_version" fi - opensuse_repo="https://download.opensuse.org/repositories/security:SELinux/$sles_version/security:SELinux.repo" repo_file_url="$DOWNLOAD_URL/linux/$lsb_dist/$REPO_FILE" pre_reqs="ca-certificates curl libseccomp2 awk" ( @@ -578,6 +577,7 @@ do_install() { EOF ( set -x; sleep 30 ) fi + opensuse_repo="https://download.opensuse.org/repositories/security:SELinux/$sles_version/security:SELinux.repo" $sh_c "zypper addrepo $opensuse_repo" $sh_c "zypper --gpg-auto-import-keys refresh" $sh_c "zypper lr -d" From a6852968549211ac78fdd581416789fad0e6d457 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 14:53:25 +0200 Subject: [PATCH 07/13] remove redundant quotes when resolving versions These were just noise :) Signed-off-by: Sebastiaan van Stijn --- install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 8560c674..aa831733 100755 --- a/install.sh +++ b/install.sh @@ -428,7 +428,7 @@ do_install() { else # Will work for incomplete versions IE (17.12), but may not actually grab the "latest" if in the test channel pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/~ce~.*/g' | sed 's/-/.*/g')" - search_command="apt-cache madison 'docker-ce' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" + search_command="apt-cache madison docker-ce | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" pkg_version="$($sh_c "$search_command")" echo "INFO: Searching repository for VERSION '$VERSION'" echo "INFO: $search_command" @@ -439,7 +439,7 @@ do_install() { exit 1 fi if version_gte "18.09"; then - search_command="apt-cache madison 'docker-ce-cli' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" + search_command="apt-cache madison docker-ce-cli | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3" echo "INFO: $search_command" cli_pkg_version="=$($sh_c "$search_command")" fi @@ -506,7 +506,7 @@ do_install() { echo "# WARNING: VERSION pinning is not supported in DRY_RUN" else pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/\\\\.ce.*/g' | sed 's/-/.*/g').*$pkg_suffix" - search_command="$pkg_manager list --showduplicates 'docker-ce' | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" + search_command="$pkg_manager list --showduplicates docker-ce | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" pkg_version="$($sh_c "$search_command")" echo "INFO: Searching repository for VERSION '$VERSION'" echo "INFO: $search_command" @@ -518,7 +518,7 @@ do_install() { fi if version_gte "18.09"; then # older versions don't support a cli package - search_command="$pkg_manager list --showduplicates 'docker-ce-cli' | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" + search_command="$pkg_manager list --showduplicates docker-ce-cli | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'" cli_pkg_version="$($sh_c "$search_command" | cut -d':' -f 2)" fi # Cut out the epoch and prefix with a '-' From 81857de3b2b4b30a2876cd484622984c6c5f7c88 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 14:59:03 +0200 Subject: [PATCH 08/13] add deprecation warnings for non-LTS Ubuntu versions that are EOL Some users confuse "YY.04" versions for LTS versions, and not all users pay close attention to versions reaching EOL. Print a warning for those as well, because we no longer publish packages for these. Signed-off-by: Sebastiaan van Stijn --- install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install.sh b/install.sh index aa831733..cc2be83b 100755 --- a/install.sh +++ b/install.sh @@ -394,6 +394,9 @@ do_install() { ubuntu.xenial|ubuntu.trusty) deprecation_notice "$lsb_dist" "$dist_version" ;; + ubuntu.impish|ubuntu.hirsute|ubuntu.groovy|ubuntu.eoan|ubuntu.disco|ubuntu.cosmic) + deprecation_notice "$lsb_dist" "$dist_version" + ;; fedora.*) if [ "$dist_version" -lt 36 ]; then deprecation_notice "$lsb_dist" "$dist_version" From 0731f2f67c693abf428cab91e689ccdb56d2283c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 16:12:39 +0200 Subject: [PATCH 09/13] validate CHANNEL, and mark "edge" and "nightly" deprecated The edge channel was already deprecated; the nightly channel has not been updated for a long time, so (for now) mark it as deprecated as well. Signed-off-by: Sebastiaan van Stijn --- install.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index cc2be83b..dab36a7b 100755 --- a/install.sh +++ b/install.sh @@ -25,10 +25,10 @@ SCRIPT_COMMIT_SHA="${LOAD_SCRIPT_COMMIT_SHA}" VERSION="${VERSION#v}" # The channel to install from: -# * nightly -# * test # * stable +# * test # * edge (deprecated) +# * nightly (unmaintained) DEFAULT_CHANNEL_VALUE="stable" if [ -z "$CHANNEL" ]; then CHANNEL=$DEFAULT_CHANNEL_VALUE @@ -71,6 +71,19 @@ case "$mirror" in ;; esac +case "$CHANNEL" in + stable|test) + ;; + edge|nightly) + >&2 echo "DEPRECATED: the $CHANNEL channel has been deprecated and no longer supported by this script." + exit 1 + ;; + *) + >&2 echo "unknown CHANNEL '$CHANNEL': use either stable or test." + exit 1 + ;; +esac + command_exists() { command -v "$@" > /dev/null 2>&1 } From a0faa888e8402c3c57486ceba9f62e57e9eaf36a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 16:48:54 +0200 Subject: [PATCH 10/13] validate --mirror, and sort options Produce an error if an unknown mirror is provided. Also sort the options in the switch. Signed-off-by: Sebastiaan van Stijn --- install.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index dab36a7b..88cb8d83 100755 --- a/install.sh +++ b/install.sh @@ -48,13 +48,13 @@ mirror='' DRY_RUN=${DRY_RUN:-} while [ $# -gt 0 ]; do case "$1" in + --dry-run) + DRY_RUN=1 + ;; --mirror) mirror="$2" shift ;; - --dry-run) - DRY_RUN=1 - ;; --*) echo "Illegal option $1" ;; @@ -69,6 +69,12 @@ case "$mirror" in AzureChinaCloud) DOWNLOAD_URL="https://mirror.azure.cn/docker-ce" ;; + "") + ;; + *) + >&2 echo "unknown mirror '$mirror': use either 'Aliyun', or 'AzureChinaCloud'." + exit 1 + ;; esac case "$CHANNEL" in From 40266b3c1e588e773a8216188dff1e95cb88b043 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 16:57:53 +0200 Subject: [PATCH 11/13] add --version option Add a --version option as alternative to the $VERSION environment variable; ./install.sh --version 20.10 # Executing docker install script, commit: + sh -c apt-get update -qq >/dev/null + sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl gnupg >/dev/null debconf: delaying package configuration, since apt-utils is not installed + sh -c install -m 0755 -d /etc/apt/keyrings + sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg + sh -c chmod a+r /etc/apt/keyrings/docker.gpg + sh -c echo "deb [arch=arm64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" > /etc/apt/sources.list.d/docker.list + sh -c apt-get update -qq >/dev/null INFO: Searching repository for VERSION '20.10' INFO: apt-cache madison docker-ce | grep '20.10' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3 INFO: apt-cache madison docker-ce-cli | grep '20.10' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3 + sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce=5:20.10.24~3-0~ubuntu-jammy docker-ce-cli=5:20.10.24~3-0~ubuntu-jammy containerd.io docker-compose-plugin docker-ce-rootless-extras=5:20.10.24~3-0~ubuntu-jammy >/dev/null Signed-off-by: Sebastiaan van Stijn --- install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install.sh b/install.sh index 88cb8d83..d87a28ee 100755 --- a/install.sh +++ b/install.sh @@ -55,6 +55,10 @@ while [ $# -gt 0 ]; do mirror="$2" shift ;; + --version) + VERSION="${2#v}" + shift + ;; --*) echo "Illegal option $1" ;; From 0766385cac75edb0c178265ffeaf53310c37d298 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 17:01:08 +0200 Subject: [PATCH 12/13] add --channel option Add a --channel option as alternative to the $CHANNEL environment variable; ./install.sh --channel test --dry-run # Executing docker install script, commit: apt-get update -qq >/dev/null DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl gnupg >/dev/null install -m 0755 -d /etc/apt/keyrings curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg chmod a+r /etc/apt/keyrings/docker.gpg echo "deb [arch=arm64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy test" > /etc/apt/sources.list.d/docker.list apt-get update -qq >/dev/null DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin >/dev/null Signed-off-by: Sebastiaan van Stijn --- install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install.sh b/install.sh index d87a28ee..cd75349d 100755 --- a/install.sh +++ b/install.sh @@ -48,6 +48,10 @@ mirror='' DRY_RUN=${DRY_RUN:-} while [ $# -gt 0 ]; do case "$1" in + --channel) + CHANNEL="$2" + shift + ;; --dry-run) DRY_RUN=1 ;; From e33616ec7614f83d68e6893123e6e8bd644f026f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 7 May 2023 17:16:48 +0200 Subject: [PATCH 13/13] rewrite instructions Provide more information how to use the script, its intended purpose, and limitations of the script. Signed-off-by: Sebastiaan van Stijn --- install.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index cd75349d..539d1544 100755 --- a/install.sh +++ b/install.sh @@ -1,22 +1,83 @@ #!/bin/sh set -e -# Docker CE for Linux installation script +# Docker Engine for Linux installation script. # -# See https://docs.docker.com/engine/install/ for the installation steps. +# This script is intended as a convenient way to configure docker's package +# repositories and to install Docker Engine, This script is not recommended +# for production environments. Before running this script, make yourself familiar +# with potential risks and limitations, and refer to the installation manual +# at https://docs.docker.com/engine/install/ for alternative installation methods. # -# This script is meant for quick & easy install via: -# $ curl -fsSL https://get.docker.com -o get-docker.sh -# $ sh get-docker.sh +# The script: # -# For test builds (ie. release candidates): -# $ curl -fsSL https://test.docker.com -o test-docker.sh -# $ sh test-docker.sh +# - Requires `root` or `sudo` privileges to run. +# - Attempts to detect your Linux distribution and version and configure your +# package management system for you. +# - Doesn't allow you to customize most installation parameters. +# - Installs dependencies and recommendations without asking for confirmation. +# - Installs the latest stable release (by default) of Docker CLI, Docker Engine, +# Docker Buildx, Docker Compose, containerd, and runc. When using this script +# to provision a machine, this may result in unexpected major version upgrades +# of these packages. Always test upgrades in a test environment before +# deploying to your production systems. +# - Isn't designed to upgrade an existing Docker installation. When using the +# script to update an existing installation, dependencies may not be updated +# to the expected version, resulting in outdated versions. # -# NOTE: Make sure to verify the contents of the script -# you downloaded matches the contents of install.sh -# located at https://github.com/docker/docker-install -# before executing. +# Source code is available at https://github.com/docker/docker-install/ # +# Usage +# ============================================================================== +# +# To install the latest stable versions of Docker CLI, Docker Engine, and their +# dependencies: +# +# 1. download the script +# +# $ curl -fsSL https://get.docker.com -o install-docker.sh +# +# 2. verify the script's content +# +# $ cat install-docker.sh +# +# 3. run the script with --dry-run to verify the steps it executes +# +# $ sh install-docker.sh --dry-run +# +# 4. run the script either as root, or using sudo to perform the installation. +# +# $ sudo sh install-docker.sh +# +# Command-line options +# ============================================================================== +# +# --version +# Use the --version option to install a specific version, for example: +# +# $ sudo sh install-docker.sh --version 23.0 +# +# --channel +# +# Use the --channel option to install from an alternative installation channel. +# The following example installs the latest versions from the "test" channel, +# which includes pre-releases (alpha, beta, rc): +# +# $ sudo sh install-docker.sh --channel test +# +# Alternatively, use the script at https://test.docker.com, which uses the test +# channel as default. +# +# --mirror +# +# Use the --mirror option to install from a mirror supported by this script. +# Available mirrors are "Aliyun" (https://mirrors.aliyun.com/docker-ce), and +# "AzureChinaCloud" (https://mirror.azure.cn/docker-ce), for example: +# +# $ sudo sh install-docker.sh --mirror AzureChinaCloud +# +# ============================================================================== + + # Git commit from https://github.com/docker/docker-install when # the script was uploaded (Should only be modified by upload job): SCRIPT_COMMIT_SHA="${LOAD_SCRIPT_COMMIT_SHA}"