Docker bash prompt does not display color output

后端 未结 5 1256
闹比i
闹比i 2020-12-23 17:10

I use command: docker run --rm -it govim bash -l to run docker images but it does not display color output. If I source ~/.bash_profile or run

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 17:26

    Adding to VonC's answer, I made this bash function:

    drun() { # start container with the specified entrypoint and colour terminal
        if [[ $# -lt 2 ]]; then
            echo "drun needs 2+ arguments: image entrypoint" >&2
            return
        fi
        docker run -ti -e "TERM=xterm-256color" "$@"
    }
    

提交回复
热议问题