diff --git a/dev/archery/archery/docker/cli.py b/dev/archery/archery/docker/cli.py index f427771d9cdd5..23c565f7780ff 100644 --- a/dev/archery/archery/docker/cli.py +++ b/dev/archery/archery/docker/cli.py @@ -28,17 +28,17 @@ def _mock_compose_calls(compose): from types import MethodType from subprocess import CompletedProcess - def _mock(compose, executable): + def _mock(compose, command_tuple): def _execute(self, *args, **kwargs): - params = ['{}={}'.format(k, v) + params = [f'{k}={v}' for k, v in self.config.params.items()] - command = ' '.join(params + [executable] + list(args)) + command = ' '.join(params + command_tuple + args) click.echo(command) return CompletedProcess([], 0) return MethodType(_execute, compose) - compose._execute_docker = _mock(compose, executable='docker') - compose._execute_compose = _mock(compose, executable='docker-compose') + compose._execute_docker = _mock(compose, command_tuple=('docker',)) + compose._execute_compose = _mock(compose, command_tuple=('docker', 'compose')) @click.group() diff --git a/dev/archery/archery/docker/core.py b/dev/archery/archery/docker/core.py index 4de75c68242d5..1c486e7aae629 100644 --- a/dev/archery/archery/docker/core.py +++ b/dev/archery/archery/docker/core.py @@ -180,7 +180,7 @@ class DockerCompose(Command): def __init__(self, config_path, dotenv_path=None, compose_bin=None, using_docker=False, using_buildx=False, params=None, debug=False): - compose_bin = default_bin(compose_bin, 'docker-compose') + compose_bin = default_bin(compose_bin, 'docker compose') self.config = ComposeConfig(config_path, dotenv_path, compose_bin, params=params, using_docker=using_docker, using_buildx=using_buildx, debug=debug) diff --git a/dev/archery/archery/docker/tests/test_docker.py b/dev/archery/archery/docker/tests/test_docker.py index 386b7c2bdae3d..0849d1e97c984 100644 --- a/dev/archery/archery/docker/tests/test_docker.py +++ b/dev/archery/archery/docker/tests/test_docker.py @@ -243,7 +243,7 @@ def assert_docker_calls(compose, expected_args): def assert_compose_calls(compose, expected_args, env=mock.ANY): - base_command = ['docker-compose', '--file', str(compose.config.path)] + base_command = ['docker', 'compose', f'--file={compose.config.path}'] expected_commands = [] for args in expected_args: if isinstance(args, str): @@ -482,7 +482,7 @@ def test_compose_push(arrow_compose_path): ] for image in ["conda-cpp", "conda-python", "conda-python-pandas"]: expected_calls.append( - mock.call(["docker-compose", "--file", str(compose.config.path), + mock.call(["docker", "compose", f"--file={compose.config.path}", "push", image], check=True, env=expected_env) ) with assert_subprocess_calls(expected_calls): @@ -514,7 +514,7 @@ def test_image_with_gpu(arrow_compose_path): "run", "--rm", "--gpus", "all", "-e", "CUDA_ENV=1", "-e", "OTHER_ENV=2", - "-v", "/host:/container:rw", + "-v", "/host:/container", "org/ubuntu-cuda", "/bin/bash", "-c", "echo 1 > /tmp/dummy && cat /tmp/dummy", ]