Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install docker-buildx-plugin on version 20.10 as well, to allow upgrading #298

Closed
wants to merge 1 commit into from

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jun 7, 2022

install docker-buildx-plugin on version 20.10 as well, to allow upgrading

The docker-buildx-plugin package can replace the version of buildx that's
bundled in the docker-ce-cli packages. This allows for buildx to be updated
to the current version, even if it was originally installed from the bundled
version.

Some testing shows that this works well, and that upgrading the docker-ce-cli
package won't revert the change, and continues using the buildx version from the
separate package.

Here's some steps to illustrate that scenario:

# remove any installed docker packages
apt-get purge -y docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin docker-buildx-plugin docker-ce-rootless-extras

# stop the docker.socket service (it blocks a clean reinstall after an uninstall)
systemctl stop docker.socket

# install docker 20.10.14 (from the test channel)
curl -fsSL https://test.docker.com | VERSION=20.10.14 sh

# verify that the installed version of buildx is the bundled (`-docker`) version:
docker buildx version
github.com/docker/buildx v0.8.1-docker 5fac64c2c49dae1320f2b51f1a899ca451935554

# install the separate `docker-buildx-plugin` package
apt-get install -y docker-buildx-plugin

# verify that it replaced the bundled version
docker buildx version
github.com/docker/buildx v0.8.2

# upgrade to docker 20.10.17
curl -fsSL https://test.docker.com | VERSION=20.10.17 sh

# verify that updating didn't downgrade the buildx plugin, or revert it to the "included" buildx version:
docker buildx version
github.com/docker/buildx v0.8.2

@thaJeztah
Copy link
Member Author

/cc @tianon @tonistiigi @chris-crone

@thaJeztah
Copy link
Member Author

CI is expected to fail currently

Copy link
Contributor

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, that makes sense too -- it's not "required" in quite the same way on 20.10, but Docker still recommends it. 👍

@thaJeztah
Copy link
Member Author

Thinking of this; I don't think I tested this yet on an rpm distro, so will need to try that as well

@thaJeztah thaJeztah mentioned this pull request Feb 2, 2023
…ding

The `docker-buildx-plugin` package can replace the version of buildx that's
bundled in the `docker-ce-cli` packages. This allows for buildx to be updated
to the current version, even if it was originally installed from the bundled
version.

Some testing shows that this works well, and that upgrading the `docker-ce-cli`
package won't revert the change, and continues using the buildx version from the
separate package.

Here's some steps to illustrate that scenario:

    # remove any installed docker packages
    apt-get purge -y docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-scan-plugin docker-buildx-plugin docker-ce-rootless-extras

    # stop the docker.socket service (it blocks a clean reinstall after an uninstall)
    systemctl stop docker.socket

    # install docker 20.10.14 (from the test channel)
    curl -fsSL https://test.docker.com | VERSION=20.10.14 sh

    # verify that the installed version of buildx is the bundled (`-docker`) version:
    docker buildx version
    github.com/docker/buildx v0.8.1-docker 5fac64c2c49dae1320f2b51f1a899ca451935554

    # install the separate `docker-buildx-plugin` package
    apt-get install -y docker-buildx-plugin

    # verify that it replaced the bundled version
    docker buildx version
    github.com/docker/buildx v0.8.2

    # upgrade to docker 20.10.17
    curl -fsSL https://test.docker.com | VERSION=20.10.17 sh

    # verify that updating didn't downgrade the buildx plugin, or revert it to the "included" buildx version:
    docker buildx version
    github.com/docker/buildx v0.8.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah changed the title remove "CHANNEL=test" check for buildx, install on 20.10 as well install docker-buildx-plugin on version 20.10 as well, to allow upgrading Jul 20, 2024
@thaJeztah thaJeztah reopened this Jul 20, 2024
@thaJeztah
Copy link
Member Author

Was cleaning up branches, and rebased this one. Gave it a go on an RPM distro (Fedora).

First install 20.10;

docker run -it --rm quay.io/centos/centos:stream9
[root@b820b456eb96 /]# curl -fsSL get.docker.com > install.sh
[root@b820b456eb96 /]# chmod +x install.sh
[root@b820b456eb96 /]# ./install.sh --version 20.10
# Executing docker install script, commit: 6d9743e9656cc56f699a64800b098d5ea5a60020
+ sh -c 'dnf --best install -y -q dnf-plugins-core'


docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.10.4-docker)
  compose: Docker Compose (Docker Inc., v2.28.1)

Then trying to upgrade the buildx plugin using the script from this PR;

curl -fsSL https://raw.githubusercontent.com/docker/docker-install/eb2ab892194e50aad24eaa96e9644509da0d4ded/install.sh > install.sh

Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'dnf makecache'
CentOS Stream 9 - BaseOS                                    54 kB/s |  13 kB     00:00
CentOS Stream 9 - AppStream                                143 kB/s |  13 kB     00:00
CentOS Stream 9 - Extras packages                          146 kB/s |  14 kB     00:00
Docker CE Stable - aarch64                                  52 kB/s | 3.5 kB     00:00
Metadata cache created.
INFO: Searching repository for VERSION '20.10'
INFO: dnf list --showduplicates docker-ce | grep '20.10.*el' | tail -1 | awk '{print $2}'
+ sh -c 'dnf --best install -y -q docker-ce-20.10.24-3.el9 docker-ce-cli-20.10.24-3.el9 containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras-20.10.24-3.el9'
Error: Transaction test error:
  file /usr/libexec/docker/cli-plugins/docker-buildx from install of docker-buildx-plugin-0:0.15.1-1.el9.aarch64 conflicts with file from package docker-ce-cli-1:20.10.24-3.el9.aarch64

Which.. fails; it doesn't like replacing files that were installed through existing packages.

@thaJeztah
Copy link
Member Author

So it looks like RPM doesn't support this scenario; from some reading up, there's 2 options to support the equivalent of deb doing a "replace";

I was hoping to cleanup the script a bit with this, by combining these branches, but perhaps the better option is to hard-fail when trying to install such old versions with this script

@thaJeztah thaJeztah self-assigned this Jul 20, 2024
@thaJeztah thaJeztah closed this Sep 26, 2024
@thaJeztah thaJeztah deleted the update_for_22.06 branch September 26, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants