首页 > 解决方案 > 如何以随机用户身份在容器中运行 github cli

问题描述

我已经设法在容器中安装了 github cli,但我无法以随机用户身份运行它(由于安全原因,open shift 确实以随机用户身份运行容器)我应该事先创建/chmod/chown 哪些目录才能使其工作?

谢谢你!

码头文件:

RUN wget https://github.com/cli/cli/releases/download/v1.0.0/gh_1.0.0_linux_amd64.deb
RUN dpkg -i gh_*_linux_amd64.deb
RUN chmod g+rwx -R /usr/local/bin/gh  # <- not enough
RUN gh version

容器日志:

...
Step 7/28 : RUN gh version
 ---> Running in 09d1ffbfcc02
Welcome to GitHub CLI!

To authenticate, please run `gh auth login`.
You can also set the GITHUB_TOKEN environment variable, if preferred.
The command '/bin/sh -c gh version' returned a non-zero code: 4
`/` is not writable.
...

标签: dockergithub-cli

解决方案


文档中有一个错误,它 gh --version 不是 gh version

RUN chmod g+rwx -R /usr/local/bin/之前提到的命令也有帮助。


推荐阅读