docker / roadmap

Welcome to the Public Roadmap for All Things Docker! We welcome your ideas.
https://github.com/orgs/docker/projects/51
Creative Commons Zero v1.0 Universal
1.74k stars 261 forks source link

Feature Suggestion: Colorize the output of docker #301

Open tbrodbeck opened 2 years ago

tbrodbeck commented 2 years ago

Expected behavior

It would be great if docker would support colorized output. This is a similar suggestion to this repo: https://github.com/kubernetes/kubectl/issues/524.

Maybe it would be possible to include this binary? https://opensourcelibs.com/lib/docker-color-output

Thanks!

thaJeztah commented 2 years ago

Thanks for your suggestion! (Sorry for the late reply, I had this on my list of tickets to reply to)

Adding colors (and making some of the output of the CLI more "pretty" in general) is something that frequently comes up in internal discussions.

The short answer is that yes we do plan to work on this

The longer answer is that this requires quite some work and design. Even though there's no strict compatibility guarantees on CLI output, with literally millions of active users of the CLI we must be careful when introducing changes. Many users use the CLI in automated setups (CI, scripts, release pipelines), and such setups can easily break on changes in the output. In addition, we try to keep a close eye on consistency (for example, when changing output, we want to make sure that all CLI components, such as docker compose, docker buildx, docker scan, docker sbom, provide a similar experience (as they're all part of the same docker CLI), which requires careful planning (as multiple teams may need to be involved).

Adding color to output is not trivial; the control characters used to colorize the output can easily break scripts that consume the output (depending on how they're run), and there are many limitations that must be worked around, taking into account that the CLI is used on various platforms; macOS, Windows (both classic "CMD.EXE" and PowerShell), which means that picking "usable" colors is sometimes, erm, "tricky"; see https://github.com/moby/buildkit/pull/2368 and https://github.com/moby/buildkit/pull/2508 for some "fun" details.

We'll keep this on our roadmap though!

spkane commented 2 years ago

@thaJeztah It would be really useful to start with "simply" making the default dark blue that is used by buildkit output, configurable via the docker client config and CLI. It is truly almost unreadable against some terminals, especially if you are doing any sort of screen share.