Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions core/testcontainers/compose/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ class DockerCompose:
to pass to docker compose.
services:
The list of services to use from this DockerCompose.
client_args:
arguments to pass to docker.from_env()
docker_command_path:
The docker compose command to run.
profiles:
The list of profiles to enable.
quiet_pull:
Whether to suppress output when pulling images.
quiet_build:
Whether to suppress output when building images.

Example:

Expand Down Expand Up @@ -214,6 +218,8 @@ class DockerCompose:
services: Optional[list[str]] = None
docker_command_path: Optional[str] = None
profiles: Optional[list[str]] = None
quiet_pull: bool = False
quiet_build: bool = False
_wait_strategies: Optional[dict[str, Any]] = field(default=None, init=False, repr=False)

def __post_init__(self) -> None:
Expand Down Expand Up @@ -278,13 +284,17 @@ def start(self) -> None:
# pull means running a separate command before starting
if self.pull:
pull_cmd = [*base_cmd, "pull"]
if self.quiet_pull:
pull_cmd.append("--quiet")
self._run_command(cmd=pull_cmd)

up_cmd = [*base_cmd, "up"]

# build means modifying the up command
if self.build:
up_cmd.append("--build")
if self.quiet_build:
up_cmd.append("--quiet-build")

if self.wait:
up_cmd.append("--wait")
Expand Down