Skip to content

Respect NO_COLOR for docker image push #6890

@rrjjvv

Description

@rrjjvv

Description

A bare docker image push generates colored output, even with NO_COLOR.

This is basically a copy/paste of #6653. Though that report mentioned image/tree specifically as did the title of #6654 , the documentation update implies that all commands should respect NO_COLOR, hence filing as a bug rather than feature request.

I rarely do plain docker image push (using bake instead), so have no idea off-hand if it has always been this way or not. However, if you look at my screenshot very closely, you can see a very small part of the output actually is honoring the setting, so it's more likely there's some special code for push that doesn't flow through the fix like the rest.


EDIT:
Also... to be very accurate, my actual complaint/issue was that docker image push generated garbage (escape codes) in CI, where everything usually "just works" as one would expect. But knowing auto-detection isn't always perfect, I expected to be able to set an environment variable or pass a flag to control it. I'm guessing the apparent failure of auto-detection and failure of NO_COLOR have the same cause, and that the fix for one is the fix for the other. So even though this report is arguably in XY problem territory, I didn't see failed auto-detection as a bug (just an annoyance), whereas not respecting the NO_COLOR is a bug, given the current documentation.


Reproduce

Nothing special. I'm pushing to an internal registry, so to avoid having to blur 'private' info, I replicated with a local container. Posting a screenshot rather than code block for obvious reasons:

Image

Note that the "Info" header does actually output in plain text; it's only the SHA output that doesn't respect the setting.

Expected behavior

No color should be present.

docker version

Client: Docker Engine - Community
 Version:           29.3.1
 API version:       1.54
 Go version:        go1.25.8
 Git commit:        c2be9cc
 Built:             Wed Mar 25 16:13:43 2026
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          29.3.1
  API version:      1.54 (minimum version 1.40)
  Go version:       go1.25.8
  Git commit:       f78c987
  Built:            Wed Mar 25 16:13:43 2026
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v2.2.2
  GitCommit:        301b2dac98f15c27117da5c8af12118a041a31d9
 runc:
  Version:          1.3.4
  GitCommit:        v1.3.4-0-gd6d73eb8
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    29.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.9.3
    Path:     /home/robertovillarreal/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.31.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.1.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.34.0
    Path:     /home/robertovillarreal/.docker/cli-plugins/docker-mcp
  model: Docker Model Runner (Docker Inc.)
    Version:  v1.1.25
    Path:     /usr/libexec/docker/cli-plugins/docker-model
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.19.0
    Path:     /home/robertovillarreal/.docker/cli-plugins/docker-scout

Server:
 Containers: 9
  Running: 9
  Paused: 0
  Stopped: 0
 Images: 28
 Server Version: 29.3.1
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /run/cdi
 Discovered Devices:
  cdi: nvidia.com/gpu=0
  cdi: nvidia.com/gpu=GPU-3a1d31e8-ef07-ef14-e974-d3223101392e
  cdi: nvidia.com/gpu=all
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc sysbox-runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 301b2dac98f15c27117da5c8af12118a041a31d9
 runc version: v1.3.4-0-gd6d73eb8
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-106-generic
 Operating System: Ubuntu 24.04.4 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 30.56GiB
 Name: l-9jylpn3
 ID: B6K2:2BOW:BSIE:WIGE:RODV:GC2B:JMYF:6XP4:25AT:3S4Q:6634:3OII
 Docker Root Dir: /var/lib/docker
 Debug Mode: true
  File Descriptors: 101
  Goroutines: 123
  System Time: 2026-03-25T20:44:49.401893965-06:00
  EventsListeners: 1
 Username: rrjjvv
 Experimental: true
 Insecure Registries:
<snip>
 Registry Mirrors:
<snip>
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.25.0.0/16, Size: 24
 Firewall Backend: iptables

Additional Info

My output/reproduction is for the version released just a few hours ago, but I originally replicated it (with the same behavior) in 29.3.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions