diff --git a/docker-configs/docker-compose_install.sh b/docker-configs/docker-compose_install.sh index 4524050..e559af2 100644 --- a/docker-configs/docker-compose_install.sh +++ b/docker-configs/docker-compose_install.sh @@ -222,22 +222,29 @@ FREEDMR_GATEWAY_FBP_RELATIONSHIPS=$(build_data_gateway_relationships \ echo echo 'Installing required packages and Docker Community Edition...' -apt-get -y remove docker docker-engine docker.io +for package in docker.io docker-compose docker-doc docker-buildx podman-docker containerd runc +do + if dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q 'ok installed' + then + apt-get -y remove "$package" + fi +done apt-get -y update -apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common -curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - -ARCH=$(/usr/bin/arch) -echo "System architecture is $ARCH" -if [ "$ARCH" = "x86_64" ] -then - ARCH="amd64" -fi -add-apt-repository \ - "deb [arch=$ARCH] https://download.docker.com/linux/debian \ - $(lsb_release -cs) \ - stable" +apt-get -y install ca-certificates curl +install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/debian/gpg \ + -o /etc/apt/keyrings/docker.asc +chmod a+r /etc/apt/keyrings/docker.asc +cat < /etc/apt/sources.list.d/docker.sources +Types: deb +URIs: https://download.docker.com/linux/debian +Suites: $(. /etc/os-release && echo "$VERSION_CODENAME") +Components: stable +Architectures: $(dpkg --print-architecture) +Signed-By: /etc/apt/keyrings/docker.asc +EOF apt-get -y update -apt-get -y install docker-ce docker-compose +apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin echo 'Configuring Docker...' cat < /etc/docker/daemon.json @@ -306,7 +313,7 @@ EOF echo 'Starting the FreeDMR release-candidate container...' cd /etc/freedmr -docker-compose up -d +docker compose up -d echo 'Read /etc/freedmr/docker-compose.yml and docs/hdstack.md before adding optional services or custom links.' echo 'FreeDMR setup complete.' diff --git a/tests/test_hdstack.py b/tests/test_hdstack.py index d331b84..dec38d8 100644 --- a/tests/test_hdstack.py +++ b/tests/test_hdstack.py @@ -532,6 +532,25 @@ class HDStackContainerTests(unittest.TestCase): self.assertIn('s/^SERVER_ID:.*/SERVER_ID: $HDSTACK_BRIDGE_ID/', installer) self.assertNotIn('/etc/freedmr/.env', installer) + def test_installer_uses_current_debian_docker_repository(self): + installer = ( + DOCKER_CONFIGS / 'docker-compose_install.sh' + ).read_text(encoding='utf-8') + + self.assertNotIn('docker-engine', installer) + self.assertIn("dpkg-query -W -f='${Status}'", installer) + self.assertIn('/etc/apt/keyrings/docker.asc', installer) + self.assertIn('/etc/apt/sources.list.d/docker.sources', installer) + self.assertIn('$(dpkg --print-architecture)', installer) + self.assertIn( + 'docker-ce docker-ce-cli containerd.io ' + 'docker-buildx-plugin docker-compose-plugin', + installer, + ) + self.assertIn('docker compose up -d', installer) + self.assertNotIn('apt-key', installer) + self.assertNotIn('add-apt-repository', installer) + def test_shipped_config_keeps_native_gateway_disabled_until_install(self): for path in ( ROOT / 'FreeDMR.cfg',