微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – Docker bash提示符不显示颜色输出

我使用命令:docker run –rm -it govim bash -l来运行docker images但是
不显示颜色输出.如果我使用〜/ .bash_profile或再次运行bash -l,则输出将正确地输出颜色.

Bash Prompt Image

My bash_profile and bash_prompt

解决方法:

OP SolomonT报告docker runenv工作:

docker run --rm -it -e "TERM=xterm-256color" govim bash -l

并且Fernando Correia添加in the comments

To get both color support and make tmux work, I combined both examples:

docker exec -it my-container env TERM=xterm-256color script -q -c "/bin/bash" /dev/null

正如chepner评论(早期回答),.bash_profile来源(它是一个交互式shell),因为bash_promptcalled by .bash_profile.

docker issue 9299说明TERM似乎没有立即设置,迫使用户打开另一个bash:

docker exec -ti test env TERM=xterm-256color bash -l

您与issue 8755有类似的颜色问题.

illustrate/reproduce the problem

docker exec -ti $CONTAINER_NAME tty
not a tty

current workaround是:

docker exec -ti `your_container_id` script -q -c "/bin/bash" /dev/null

两者都假设你首先有一个正在运行的容器,这在这里可能不方便.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐