Skip to content

Commit 183e1aa

Browse files
authored
fix(compose): expose useful compose options (#951)
`docker compose up` exposes `--quiet-pull` and `--quiet-build` arguments to control verbosity. I'm trying to expose those here
1 parent be4d09e commit 183e1aa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

core/testcontainers/compose/compose.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,14 @@ class DockerCompose:
177177
to pass to docker compose.
178178
services:
179179
The list of services to use from this DockerCompose.
180-
client_args:
181-
arguments to pass to docker.from_env()
182180
docker_command_path:
183181
The docker compose command to run.
182+
profiles:
183+
The list of profiles to enable.
184+
quiet_pull:
185+
Whether to suppress output when pulling images.
186+
quiet_build:
187+
Whether to suppress output when building images.
184188
185189
Example:
186190
@@ -214,6 +218,8 @@ class DockerCompose:
214218
services: Optional[list[str]] = None
215219
docker_command_path: Optional[str] = None
216220
profiles: Optional[list[str]] = None
221+
quiet_pull: bool = False
222+
quiet_build: bool = False
217223
_wait_strategies: Optional[dict[str, Any]] = field(default=None, init=False, repr=False)
218224

219225
def __post_init__(self) -> None:
@@ -278,13 +284,17 @@ def start(self) -> None:
278284
# pull means running a separate command before starting
279285
if self.pull:
280286
pull_cmd = [*base_cmd, "pull"]
287+
if self.quiet_pull:
288+
pull_cmd.append("--quiet")
281289
self._run_command(cmd=pull_cmd)
282290

283291
up_cmd = [*base_cmd, "up"]
284292

285293
# build means modifying the up command
286294
if self.build:
287295
up_cmd.append("--build")
296+
if self.quiet_build:
297+
up_cmd.append("--quiet-build")
288298

289299
if self.wait:
290300
up_cmd.append("--wait")

0 commit comments

Comments
 (0)