【问题标题】:Docker Bash Has No ColourDocker Bash 没有颜色
【发布时间】:2016-10-25 05:17:34
【问题描述】:

当我跑步时

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 工具箱中的 Docker 快速启动终端。我有 docker 版本 1.12.0,构建 8eab29e。

【问题讨论】:

    标签: linux bash shell docker


    【解决方案1】:

    要解决此问题,您需要更新 ~/.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,它会自动执行此操作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-03
      • 2022-10-13
      • 2016-03-06
      • 2020-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-19
      相关资源
      最近更新 更多