Provide more information how to use the script, its intended purpose, and
limitations of the script.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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 <github@gone.nl>
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 <github@gone.nl>
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 <github@gone.nl>
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 <github@gone.nl>
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 <github@gone.nl>
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 <github@gone.nl>
This explict install was added because docker 20.10 did not have an explicit
dependency on the plugin. The current release of the Docker CLI (23.0) already
has a "Recommends:" dependency on the plugin, and 0095742fb5
removed the "--no-install-recommends", so fresh installs of Docker 23.0 will
already install this plugin through that dependency.
Removing the explicit install, because the scan-cli-plugin has been deprecated,
and will no longer receive updates, so we don't want it to be installed for the
upcoming 24.0 release when using this script. see;
https://github.com/docker/scan-cli-plugin/blob/b69ac460a6c23243b858326f0e26f6bd202ca781/internal/deprecation.go#L13-L15
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Now that 0095742fb5 removed the "--no-install-recommends"
option for all packages, we no longer need to special-case installation of the rootless-extras
package.
This patch moves the package together with other conditional packages for 20.10 and up. The
order of these conditionals was updated to match the equivalent steps of the RPM packages.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This variable was introduced in 63fb2060c9, but
was later refactored in ab03892649 aligned the
installation steps for SLES with the other distros (using the version of the
"docker-ce" package itself, as those versions always match).
This patch removes the unused rootless_pkg_version variable, and the code to
resolve that version.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The installation for deb packages used a --no-install-recommends to skip "recommended"
packages. This flag was added in ab5553e302 to work around
an issue on Ubuntu 17.10 (which had aufs-tools as recommended dependency), causing the
kernel to be updated.
While "recommended" packages _can_ be omitted during installation, they are
a "strong" recommendation, and should really be installed by default:
> Recommends
>
> This declares a strong, but not absolute, dependency.
> The Recommends field should list packages that would be found together
> with this one in all but unusual installations.
Including the `--no-install-recommends` option could result in `apparmor_parser`
binary (part of the `apparmor` package) to be missing, which would cause
the daemon failing to start on systems with AppArmor support enabled:
Error response from daemon: AppArmor enabled on system but the docker-default profile could not be loaded: running `apparmor_parser apparmor_parser --version` failed with output:
error: exec: "apparmor_parser": executable file not found in $PATH
Error: failed to start containers: somecontainer
This patch removes the `--no-install-recommends` so that the recommended
packages are installed.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The version-format of the packages changed in the docker-ce-packaging repo;
https://github.com/docker/docker-ce-packaging/commit/39772a761dfdf810cc23a1ec6084ea3100e6abf0
Which caused the script to fail when specifying a version:
INFO: Searching repository for VERSION '23.0.0-rc.2'
INFO: apt-cache madison 'docker-ce' | grep '23.0.0.*rc.2.*-0~debian' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
ERROR: '23.0.0-rc.2' not found amongst apt-cache madison results
Looking at that search, it seemed like it was overly strict;
- matching the distro (debian, ubuntu, or raspbian), which should not be needed,
assuming the package repository has been set up correctly (which the script
does in earlier steps).
- matching the "0" prefix, which was intended to be used a package-revision (so
to allow for packaging-only releases). That part definitely shouldn't be done,
as it would not match later revisions (1, 2, 3)
This patch simplifies the matching, and only searches for the package name, and
the version specified, which should satisfy the requirement;
apt-cache madison 'docker-ce' | grep '23.0.0.*rc.2' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
5:23.0.0~rc.2-1~ubuntu.22.04~jammy
apt-cache madison 'docker-ce-cli' | grep '23.0.0.*rc.2' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
5:23.0.0~rc.2-1~ubuntu.22.04~jammy
With this patch applied, the installation succeeds:
cat install.sh | DOWNLOAD_URL=https://download-stage.docker.com CHANNEL=test VERSION=23.0.0-rc.2 REPO_FILE=docker-ce-staging.repo sh
...
INFO: Searching repository for VERSION '23.0.0-rc.2'
INFO: apt-cache madison 'docker-ce' | grep '23.0.0.*rc.2' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
INFO: apt-cache madison 'docker-ce-cli' | grep '23.0.0.*rc.2' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends docker-ce=5:23.0.0~rc.2-1~ubuntu.22.04~jammy docker-ce-cli=5:23.0.0~rc.2-1~ubuntu.22.04~jammy containerd.io docker-compose-plugin docker-scan-plugin docker-buildx-plugin >/dev/null
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
These checks were originally added in 3217c543b4,
which added a `REPO_FILE` variable. While it's with good intent to do a check
if the URL is valid, there are some issues with these checks;
The checks depend on `curl`, but are executed _before_ `pre_reqs` are installed,
so will produce an error if `curl` is not found;
./install.sh
# Executing docker install script, commit:
./install.sh: line 469: curl: command not found
Error: Unable to curl repository file https://download.docker.com/linux/fedora/docker-ce.repo, is it valid?
The checks are currently always performed, also if `DRY_RUN=1` is enabled;
DRY_RUN=1 REPO_FILE=no-such.repo ./install.sh
# Executing docker install script, commit:
Error: Unable to curl repository file https://download.docker.com/linux/fedora/no-such.repo, is it valid?
This patch removes the checks to address the above, and to simplify the script.
Running the script will still fail if an invalid URL is used for the `.repo` file,
which fails the script after the `pre_reqs` are installed;
With this patch:
When running the script with `DRY_RUN=1`:
DRY_RUN=1 ./install.sh
# Executing docker install script, commit:
dnf install -y -q dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
dnf makecache
dnf install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras
When running the script with `DRY_RUN=1` and an invalid repo, the script
completes successfully, but will show the commands it will run, including
the invalid URL:
DRY_RUN=1 REPO_FILE=no-such.repo ./install.sh
# Executing docker install script, commit:
dnf install -y -q dnf-plugins-core
dnf config-manager --add-repo https://download.docker.com/linux/fedora/no-such.repo
dnf makecache
dnf install -y -q docker-ce docker-ce-cli containerd.io docker-scan-plugin docker-compose-plugin docker-ce-rootless-extras
When running the script with an invalid repo URL, it will fail early (after
installing `pre_reqs`:
REPO_FILE=no-such.repo ./install.sh
# Executing docker install script, commit:
+ sh -c 'dnf install -y -q dnf-plugins-core'
...
+ sh -c 'dnf config-manager --add-repo https://download.docker.com/linux/fedora/no-such.repo'
Adding repo from: https://download.docker.com/linux/fedora/no-such.repo
Status code: 404 for https://download.docker.com/linux/fedora/no-such.repo (IP: 65.9.86.56)
Error: Configuration of repo failed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The buildx plugin has moved to a separate package for the 22.06 release.
We're currently doing test-builds on staging, so only try to install
this when using both the "test" channel and the staging domain.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
See https://tracker.debian.org/news/1305679/accepted-apt-240-source-into-unstable/:
* Install an empty /etc/apt/keyrings directory.
This directory is intended to provide an alternative to
/usr/share/keyrings for placing keys used with signed-by.
See also https://wiki.debian.org/DebianRepository/UseThirdParty?action=diff&rev2=47&rev1=46
(which was edited following a discussion with the APT maintainers about the expected usage):
> If future updates to the key will be managed by an apt/dpkg package as
> recommended below, then it SHOULD be downloaded into `/usr/share/keyrings`
> using the same filename that will be provided by the package. If it will
> be managed locally , it SHOULD be downloaded into `/etc/apt/keyrings` instead.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
While the script isn't intended for updating existing installations,
some users use it for that purpose, and when doing so may end up in
a situation where only the docker packages are updated, but containerd
is kept at the already installed version.
This patch explicitly installs the containerd.io package so that running
the script on an existing installation also updates the containerd.io
package to the latest version.
Docker packages before 18.09 bundled containerd in the docker-ce package,
so this step is made options based on the version that's requested to be
installed (defaults to "latest").
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Some environments may have a non-standard (non 022) umask set, in which case
the keyring would not get read-permissions for all users, which lead to errors
during install:
W: GPG error: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7EA0A9C3F273FCD8
This commit changes the permissions of the file, so that it's world-readable.
See https://stackoverflow.com/a/68764068
Co-Authored-By: ManhIT <manhit@s-developers.com>
Co-Authored-By: Hervé M <hmag@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Jessie reached EOL quite some time ago, and we do not support
Debian/Ubuntu derrivatives, so removing code for Kali Linux.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This adds a deprecation warning for distro versions that reached EOL, and for
which we no longer maintain updates.
Note that the list of versions for which we produce warnings is not "complete",
and only contains versions that either reached EOL recently, or LTS versions
that may still be commonly in use.
With this patch;
Running inside a fedora:32 container:
DEPRECATION WARNING
This Linux distribution (fedora 32) reached end-of-life and is no longer supported by this script.
No updates or security fixes will be released for this distribution, and users are recommended
to upgrade to a currently maintained version of fedora.
Press Ctrl+C now to abort this script, or wait for the installation to continue.
^C
Running inside an ubuntu:xenial container:
DEPRECATION WARNING
This Linux distribution (ubuntu xenial) reached end-of-life and is no longer supported by this script.
No updates or security fixes will be released for this distribution, and users are recommended
to upgrade to a currently maintained version of ubuntu.
Press Ctrl+C now to abort this script, or wait for the installation to continue.
^C
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The scripts is using "--no-install-recommends" to provide a more
minimal install, and to prevent installing "latest" version of
(e.g.) the engine when installing the CLI.
This patch:
- adds some utilities to compare versions
- skips CLI-version discovery on older versions (before 18.09)
which did not have separate packages for the CLI
- on versions 20.10 and up (or if no version was specified), also
install the scan cli plugin (support for cli plugins was added
in docker 19.03, but not installing on that version by default))
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
When upgrading docker from versions older than v1.10, the image
store must be migrated for the content-addressable store.
Docker 1.10 was released more than 5 years ago, so people running
versions older than that, probably have more urgent things to
be concerned about, so removing this warning.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- use "/go/" redirect URLs for links to docs.docker.com, which are
easier to remember, and allows us the flexibility to point them
to new locations in the docs if content is moved.
- remove instructions for giving non-root access, and instead
include a link to the documentation. The existing "usermod"
instruction may not be complete, and may not work on all
platforms, so providing a link to the documentation allows
us to go more into depth.
- remove the (now unused) $your_user variable
- Update the "daemon attack surface" warning to mention
"privileged Docker daemon", to make clear that this is
mostly (only) a concern if the daemon is not running
rootless.
- Wrapped / rephrased the output to make sure it fits in
80-characters (to prevent unwanted wrapping)
- Fixed / updated some other links while at it.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
this shouldn't affect users downloading, but makes it easier
to debug the script while making changes.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>