设置 docker & kubectl 命令行自动完成 (bash completion)

  • 安装 bash-completion
    • yum install -y bash-completion
    • source /usr/share/bash-completion/bash_completion
  • 测试安装是否成功
    • type _init_completion
  • 设置 docker completion
    • sudo curl -L https://raw.githubusercontent.com/docker/compose/1.24.0/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
  • 设置 kubectl completion
    • echo 'source <(kubectl completion bash)' >>~/.bashrc
    • kubectl completion bash >/etc/bash_completion.d/kubectl
    • source ~/.bashrc

你可能感兴趣的:(设置 docker & kubectl 命令行自动完成 (bash completion))