From b1465538816e4a71b872a1a5cb8ca5088b3d129a Mon Sep 17 00:00:00 2001 From: Kai Lueke Date: Mon, 22 May 2023 17:57:47 +0200 Subject: [PATCH] Add docker compose CLI plugin sysext The standalone docker-compose binary is replaced by a new CLI plugin. This CLI plugin needs to live under /usr, thus we have to use a sysext image. Add a helper to create a sysext image. While we could also add it by default to the docker sysext script, the separate usage is of more interest because it can be used with Flatcar's default Docker. Done by following https://docs.docker.com/compose/install/linux/#install-the-plugin-manually --- create_docker_compose_sysext.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 create_docker_compose_sysext.sh diff --git a/create_docker_compose_sysext.sh b/create_docker_compose_sysext.sh new file mode 100755 index 0000000..ce5f046 --- /dev/null +++ b/create_docker_compose_sysext.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -euo pipefail + +export ARCH="${ARCH-x86_64}" +SCRIPTFOLDER="$(dirname "$(readlink -f "$0")")" + +if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + echo "Usage: $0 VERSION SYSEXTNAME" + echo "The script will download the docker compose CLI plugin binary (e.g., for 2.18.1) and create a sysext squashfs image with the name SYSEXTNAME.raw in the current folder." + echo "A temporary directory named SYSEXTNAME in the current folder will be created and deleted again." + echo "All files in the sysext image will be owned by root." + echo "To use arm64 pass 'ARCH=aarch64' as environment variable (current value is '${ARCH}')." + "${SCRIPTFOLDER}"/bake.sh --help + exit 1 +fi + +VERSION="$1" +SYSEXTNAME="$2" + +rm -rf "${SYSEXTNAME}" +mkdir -p "${SYSEXTNAME}"/usr/local/lib/docker/cli-plugins +curl -o "${SYSEXTNAME}"/usr/local/lib/docker/cli-plugins/docker-compose -fsSL "https://github.com/docker/compose/releases/download/v${VERSION}/docker-compose-linux-${ARCH}" +chmod +x "${SYSEXTNAME}"/usr/local/lib/docker/cli-plugins/docker-compose +"${SCRIPTFOLDER}"/bake.sh "${SYSEXTNAME}" +rm -rf "${SYSEXTNAME}"