当我跑步时
docker run -i -t python /bin/bash
生成的终端没有颜色。
我查看了以下链接,他们没有帮助:
Docker bash prompt not display color
https://groups.google.com/forum/#!topic/docker-user/Bp4BaWRw6k4
https://github.com/docker/docker/issues/9299
我在Windows 10上使用Docker Toolbox中的Docker Quickstart终端。我有docker版本1.12.0,build 8eab29e。
答案 0 :(得分:2)
要解决此问题,您需要更新~/.bashrc
文件。
添加这样的东西(借用默认的Ubuntu ~/.bashrc
文件)应该可以解决这个问题:
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
更新~/.bash
文件后,您需要运行source ~/.bashrc
重新加载文件。
您可能想要创建自己的dockerfile,它会自动执行此操作。