Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] docker-compose pull/up sends non-critical logs to stderr, causing issues in CI/CD pipelines #12307

Closed
rollinbe opened this issue Nov 19, 2024 · 1 comment

Comments

@rollinbe
Copy link

Description

Problem Description

When using docker-compose pull or docker-compose up, non-critical log messages (e.g., progress updates, container recreation messages) are sent to stderr. This behavior causes CI/CD tools (e.g., Azure DevOps, GitLab CI/CD) to misinterpret these as errors, even when the commands execute successfully.

Impact

This behavior creates unnecessary complications in CI/CD pipelines, requiring workarounds like redirecting stderr to stdout (2>&1) or filtering logs. This not only leads to wasted time but also violates standard practices where stderr should be reserved exclusively for error messages.

Why This Matters

This behavior significantly disrupts CI/CD workflows, leading to wasted time troubleshooting false-positive errors. Fixing this would streamline integration and align Docker Compose with standard logging practices.

Thank you for addressing this issue promptly, as it heavily impacts automation in production environments.

Steps To Reproduce

  1. Create a valid docker-compose.yml.
  2. Run docker-compose pull or docker-compose up in a terminal or CI/CD environment.
  3. Observe that progress updates and other non-critical logs are sent to stderr.

Compose Version

Docker Compose Version: 1.29.2

Docker Environment

Docker Version:  20.10.24+dfsg1, build 297e128

Anything else?

Adopt standard logging practices:

  • Use stdout for informational and non-critical log messages.
  • Reserve stderr for actual errors.
@ndeloof
Copy link
Contributor

ndeloof commented Nov 20, 2024

Unfortunately POSIX only defines stdout and stderr, as the former is used for application logs, there's no better choice for compose but the latter to send status messages. Your CI/CD tools to consider any use os stderr as a proof or error, without considering process exit code as the source of truth is weird.

you can set COMPOSE_STATUS_STDOUT=true environment variable so that compose will use stdout to log information message.

@ndeloof ndeloof closed this as completed Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants