-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
Description
When running make outside the container, the following warning is displayrd:
\033[1mWARNING\033[0m: you are not in a container.
Reproduce
- make binary
Expected behavior
The warning text should be displayed in bold correctly in all POSIX-compliant shells
docker version
Client:
Version: 29.2.1
API version: 1.53
Go version: go1.25.6 X:nodwarf5
Git commit: a5c7197d72
Built: Thu Feb 5 10:59:55 2026
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 29.2.1
API version: 1.53 (minimum version 1.44)
Go version: go1.25.6 X:nodwarf5
Git commit: 6bc6209b88
Built: Thu Feb 5 10:59:55 2026
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.2.1
GitCommit: dea7da592f5d1d2b7755e3a161be07f43fad8f75.m
runc:
Version: 1.4.0
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0docker info
Client:
Version: 29.2.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.31.1
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 5.1.0
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 5
Running: 0
Paused: 0
Stopped: 5
Images: 41
Server Version: 29.2.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
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.18.8-arch2-1-surface
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.54GiB
Name: literally
ID: 4e2fe906-d9d1-4e04-9512-ba13d86dce56
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Firewall Backend: iptablesAdditional Info
in POSIX sh (and also on some systems, including macos and bsd) echo does not interpret escape sequences by default, and the -e flag is not standardized behavior. And because of this outputting colors via echo does not work on all systems
I propose replacing the use of echo for ANSI colors with printf, which is guaranteed to interpret correctly on all POSIX-compliant systems.
like this:
(
printf "\n"
printf "\033[1mWARNING\033[0m: you are not in a container."
printf
printf 'Use "\033[1mmake dev\033[0m" to start an interactive development container,'
printf "use \"\033[1mmake -f docker.Makefile $target\033[0m\" to execute this target"
printf "in a container, or set \033[1mDISABLE_WARN_OUTSIDE_CONTAINER=1\033[0m to"
printf "disable this warning."
printf
printf "Press \033[1mCtrl+C\033[0m now to abort, or wait for the script to continue.."
printf "\n"
) >&2Reactions are currently unavailable