在Jenkins docker镜像中安装bundler
是否有可能在jenkins
镜像中安装ruby,尤其是jenkins
。
我可以从文档中看到,您可以附加到容器或使用docker exec -i -t 4e2bf4128e3e bash
。 这将logging我作为jenkins@4e2bf4128e3e
。
但是,如果我尝试安装任何东西
apt-get install ruby 2.0.0 # Yes will install rvm, this is just an example
我明白了
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
而当我尝试
sudo apt-get install ruby 2.0.0
然后我得到sudo command not found
任何帮助赞赏
你所遇到的问题是,正如你在这里看到的,jenkins docker图像像禁止使用apt的jenkins用户一样执行命令。
在https://hub.docker.com/_/jenkins/上有一些文档,即“安装更多工具”部分,build议您这样做:
FROM jenkins # if we want to install via apt USER root RUN apt-get update && apt-get install -y ruby make more-thing-here USER jenkins # drop back to the regular jenkins user - good practice
您可以创build自己的图像,将这两个图像分层
Dockerfile
FROM jenkins FROM ruby ...
现在你有一个你自己的docker集装箱,有ruby和jenkins。
- 在Docker中启用Wildfly域模式的debugging – 端口已经在使用
- Docker for Windows安装程序在PresentationFramework.Aero2上失败
- 无法推送图片:拒绝:请求访问资源被拒绝
- 使用wget获取Ubuntu SDK的最新版本
- 如何通过docker撰写selenium服务器
- docker堆栈部署Windows工作目录前面的卷path
- 'npm ERR! 运行npm install作为docker build的一部分
- 在特定进程的开发环境中将docker作为非root用户运行
- 如何使用docker-compose和docker-machine为mongoDB挂载外部卷