Skip to content

Conversation

@Pnkcaht
Copy link

@Pnkcaht Pnkcaht commented Jan 24, 2026

What I did

Implemented a "quiet mode" for Docker Compose up command that suppresses normal container logs while still showing critical events such as errors and non-zero exit codes.
This allows developers to attach to multiple services in a minimal output mode (--progress=quiet, --no-log-prefix) without being overwhelmed by standard logs, improving readability during CI, debugging, or automated testing.

Related issue

Fixed #13554

What was the problem?

When running Docker Compose with multiple attached containers:

  • Standard output included all logs, making it hard to spot errors
  • --progress=quiet or --no-log-prefix did not fully suppress non-critical logs
  • Developers had no easy way to see only failures or exit codes when testing locally or in CI

As a result:

  • Debugging multiple containers was noisy
  • Quiet build/test workflows were cumbersome
  • Automation scripts needed extra log filtering

How this change fixes it

  • Introduced quietLogConsumer implementing api.LogConsumer that:

    • Ignores normal log messages (Log method)
    • Ignores status updates (Status method)
    • Still prints critical container errors and non-zero exit codes (HandleEvent and Err)
  • Updated composeService.Up to detect quiet mode (logConsumer == nil) and switch log handling accordingly

  • Supports multiple attached services simultaneously in quiet mode

  • Preserves interactive navigation menu if used

This preserves critical feedback while reducing noise in logs.

Before / After (Summary)

Before:

  • Running docker compose up with --progress=quiet still printed all logs
  • Multiple attached containers flooded the terminal
  • Hard to identify which containers failed

After:

  • Quiet mode shows only errors and exit codes
  • Normal logs are suppressed
  • Multiple attached containers are cleanly monitored
  • Developers can focus on critical events and automate testing more easily

Diagram

flowchart TD
    A[docker compose up] --> B{Mode?}
    B -->|Quiet| C[quietLogConsumer]
    B -->|Normal| D[normal logConsumer]
    C --> E[logPrinter]
    D --> E
    E --> F[Monitor & Handle Events]
    F --> G[Output to terminal]

    style C fill:#f9f,stroke:#333,stroke-width:1px
    style D fill:#bbf,stroke:#333,stroke-width:1px
    style G fill:#bfb,stroke:#333,stroke-width:1px

Loading

Screenshot Test & Output

Multi-container Test

This test runs three separate BusyBox containers (busybox1, busybox2, busybox3) simultaneously to validate the quiet mode logging.

  • Confirms that only critical events (non-zero exits) are printed in quiet mode.
  • Ensures normal logs are suppressed while still allowing container attachment.
  • Verifies that exit codes are captured correctly for multiple containers in parallel.

Output demonstrates that:

  • busybox2 exited with code 1 → logged in quiet mode.
  • busybox1 and busybox3 exited with code 0 → no log output, as expected.
test

Quiet Mode (Version 1)

Only critical events (containers exiting with non-zero code) are printed. Normal logs are suppressed.

quiet

Normal Mode (Version 2)

All container logs are printed in real time. Quiet mode suppression is not applied. Exit codes still show.

image

Codes and Explain

quietLogConsumer: Minimal Logging for Quiet Mode

The quietLogConsumer type implements the api.LogConsumer interface to provide a quiet mode for Docker Compose (--progress=quiet or --no-log-prefix). Its purpose is to suppress normal logs while still reporting critical events, making it ideal for CI, debugging, or multi-container testing.

Methods

  • HandleEvent(event api.ContainerEvent)
    Processes container lifecycle events.

    • Only prints containers that exited with a non-zero code.
    • Output goes to stderr to separate it from normal logs.
  • Log(service, msg string)
    Called for standard container log messages.

    • Suppresses all normal logs to keep output minimal.
  • Err(service, msg string)
    Called for critical error messages related to a container/service.

    • Prints errors to stderr even in quiet mode.
  • Status(service, msg string)
    Called for container status updates (e.g., starting/stopping).

    • Suppressed to reduce noise during quiet mode runs.
image

Quiet Mode Setup

  • Checks if quiet mode is active (logConsumer == nil)
  • Chooses the appropriate log printer:
    • quietLogConsumer → suppress normal logs, show only errors and non-zero exits
    • normal logConsumer → print all logs
  • Creates a global context to manage goroutines and allow graceful shutdown
  • If the navigation menu is active, attaches a detach handler to cancel()
image

Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
Signed-off-by: pnkcaht <samzoovsk19@gmail.com>
@Pnkcaht Pnkcaht requested a review from a team as a code owner January 24, 2026 20:37
@Pnkcaht Pnkcaht requested review from glours and ndeloof January 24, 2026 20:37
@Pnkcaht
Copy link
Author

Pnkcaht commented Jan 24, 2026

@ndeloof Okay, I'm available to clean up more issues here if I'm accepted into this pull request. Anything you see, even the smallest thing, that needs changing (even if it has no effect), please let me know, i want it to be perfect. Thanks :) ❤️ 👍🏻

@ndeloof
Copy link
Contributor

ndeloof commented Jan 25, 2026

quiet mode should not remove container logs, which is a required output. Users who want to exclude services from output should rely on --attach to select only relevant services

@Pnkcaht
Copy link
Author

Pnkcaht commented Jan 25, 2026

quiet mode should not remove container logs, which is a required output. Users who want to exclude services from output should rely on --attach to select only relevant services

Ok, i agree, if you think there’s anything useful I can adjust just let me know and I’ll take care of it, thanks loof :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] docker compose not respecting --progress quiet

2 participants