Open lunrenyi opened 1 month ago
What is your real TERM in which you are running docker? Use -e TERM
to provide your terminal type to docker. Otherwise, https://github.com/muesli/termenv detects the default value TERM=xterm
as a generic non-colour terminal because the docker container doesnât know your real environment.
In my Mac environment, TERM=xterm tz
displays correctly, but it doesn't show up properly within a Docker Ubuntu image.
macOS
docker Ubuntu image
This suggests your macOS terminal environment has additional environment variables set (termenv detects these). Whereas docker run
wipes the environment information by default, so differences should be expected. Normally, TERM=xterm tz
on macOS is black-and-white, same as Docker.
Also, which version of tz -v
are you using in each environment? (E.g. macOS Homebrew currently has version 0.7.0, but Iâm not sure what youâre using within Docker.)
Also, which version of
tz -v
are you using in each environment? (E.g. macOS Homebrew currently has version 0.7.0, but Iâm not sure what youâre using within Docker.)
They are all version 0.7.0, sourced from https://github.com/oz/tz/releases/tag/v0.7.0
I also have 0.7.0 and it works as expected: uncoloured with TERM=xterm
, 16-colour with TERM=xterm-colour
, and 256-colour with TERM=xterm-256color
. The differences in your screenshots are probably due to the discrepancies between your environments. If you align your environments, you should see the same.
Hi @lunrenyi if youâre using iTerm, it sets some environment variables like COLORTERM=truecolor
and TERM=xterm-256color
which are different inside the Ubuntu Docker container, hence the discrepancy. If you pass your COLORTERM to docker, it will override TERM=xterm
for colour detection, and tz
will give you the result you expect: docker run -e COLORTERM ...
. Regards