Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
Implemented a "quiet mode" for Docker Compose
upcommand 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:
--progress=quietor--no-log-prefixdid not fully suppress non-critical logsAs a result:
How this change fixes it
Introduced
quietLogConsumerimplementingapi.LogConsumerthat:Logmethod)Statusmethod)HandleEventandErr)Updated
composeService.Upto detect quiet mode (logConsumer == nil) and switch log handling accordinglySupports 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:
docker compose upwith--progress=quietstill printed all logsAfter:
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:1pxScreenshot Test & Output
Multi-container Test
This test runs three separate BusyBox containers (busybox1, busybox2, busybox3) simultaneously to validate the quiet mode logging.
Output demonstrates that:
Quiet Mode (Version 1)
Only critical events (containers exiting with non-zero code) are printed. Normal logs are suppressed.
Normal Mode (Version 2)
All container logs are printed in real time. Quiet mode suppression is not applied. Exit codes still show.
Codes and Explain
quietLogConsumer: Minimal Logging for Quiet Mode
The
quietLogConsumertype implements theapi.LogConsumerinterface to provide a quiet mode for Docker Compose (--progress=quietor--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.
stderrto separate it from normal logs.Log(service, msg string)
Called for standard container log messages.
Err(service, msg string)
Called for critical error messages related to a container/service.
stderreven in quiet mode.Status(service, msg string)
Called for container status updates (e.g., starting/stopping).
Quiet Mode Setup
logConsumer == nil)cancel()