Skip to content

Commit

Permalink
docker-compose: Switch to docker compose v2
Browse files Browse the repository at this point in the history
docker-compose v1 (implemented in Python) has stopped receiving update
in July 2023 and the version installed on Cirrus's docker_builder image
is incompatible with the latest docker-py version, resulting in total
test failures.

This commit switches over the docker-compose invocations to 'docker
compose' as required by docker compose v2. compose is now a plugin of
docker, implemented in Go. It's installable on Ubuntu, for example,
as docker-compose-v2 package.
  • Loading branch information
awelzel committed Mar 15, 2024
1 parent 4545b99 commit 3982e24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Scripts/docker-compose-teardown
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if docker ps -a | grep -q $controller; then
fi

# Grab the Docker logs
docker-compose -p ${testname}_ -f docker-compose.yml logs >docker-compose.logs
docker compose -p ${testname}_ -f docker-compose.yml logs >docker-compose.logs

[ -n "$TEST_SKIP_DOCKER_TEARDOWN" ] && exit 0
[ "$TEST_FAILED" -eq 1 ] && [ -n "$TEST_SKIP_DOCKER_TEARDOWN_ON_FAILURE" ] && exit 0
Expand All @@ -28,6 +28,6 @@ if [ ! -f docker-compose.yml ]; then
fi

# Don't wait at all for clean container shutdown
docker-compose -p ${testname}_ -f docker-compose.yml down -t 0
docker compose -p ${testname}_ -f docker-compose.yml down -t 0

exit 0
4 changes: 2 additions & 2 deletions Scripts/docker-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ command -v docker >/dev/null || {
exit 1
}

command -v docker-compose >/dev/null || {
echo "docker-compose command unavailable"
docker compose version >/dev/null || {
echo "docker compose plugin unavailable"
exit 1
}

Expand Down
6 changes: 3 additions & 3 deletions Scripts/docker-setup
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ docker_populate() {
fi
}

# The corresponding "docker-compose down" happens in docker-compose-teardown.
# The corresponding "docker compose down" happens in docker-compose-teardown.
# Might shift this around in the future for better symmetry.
docker_compose_up() {
local config1="${1:-docker-compose.yml}"
local config2="${2:-docker-compose.override.yml}"

if [ -f "${config2}" ]; then
docker-compose -p ${testname} -f "$config1" -f "$config2" up -d
docker compose -p ${testname} -f "$config1" -f "$config2" up -d
else
docker-compose -p ${testname} -f "$config1" up -d
docker compose -p ${testname} -f "$config1" up -d
fi
}

Expand Down

0 comments on commit 3982e24

Please sign in to comment.