我有一个执行以下操作的docker文件:
RUN apk update && apk add ruby ruby-irb ruby-rake ruby-io-console ruby-bigdecimal ruby-json ruby-bundler
我收到此错误日志:
$ bundle
[33m`/opt/jenkins` is not writable.
Bundler will use `/tmp/bundler/home/jenkins' as your home directory temporarily.
[0mFetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies..............
[32mFetching rake 10.3.2[0m
[33mRetrying download gem from https://rubygems.org/ due to error (2/4): Errno::ENOENT No such file or directory @ rb_sysopen - /opt/jenkins/.gem/ruby/2.4.0/cache/rake-10.3.2.gem[0m
[33mRetrying download gem from https://rubygems.org/ due to error (3/4): Errno::ENOENT No such file or directory @ rb_sysopen - /opt/jenkins/.gem/ruby/2.4.0/cache/rake-10.3.2.gem[0m
[33mRetrying download gem from https://rubygems.org/ due to error (4/4): Errno::ENOENT No such file or directory @ rb_sysopen - /opt/jenkins/.gem/ruby/2.4.0/cache/rake-10.3.2.gem[0m
[31mErrno::ENOENT: No such file or directory @ rb_sysopen -
/opt/jenkins/.gem/ruby/2.4.0/cache/rake-10.3.2.gem
[0m[0m[31mAn error occurred while installing rake (10.3.2), and Bundler
cannot continue.
Make sure that `gem install rake -v '10.3.2'` succeeds before bundling.[0m
In Gemfile:
aws_account_utils was resolved to 0.1.4, which depends on
rake[0m
Build step 'Execute shell' marked build as failure
当我尝试如下安装rake时:
gem install rake -v 10.3.2
作为构建作业中的命令,我得到:
Fetching: rake-10.3.2.gem
Fetching: rake-10.3.2.gem ( 2%)
Fetching: rake-10.3.2.gem ( 4%)
Fetching: rake-10.3.2.gem ( 6%)
Fetching: rake-10.3.2.gem ( 8%)
Fetching: rake-10.3.2.gem ( 10%)
Fetching: rake-10.3.2.gem ( 12%)
Fetching: rake-10.3.2.gem ( 14%)
Fetching: rake-10.3.2.gem ( 16%)
Fetching: rake-10.3.2.gem ( 19%)
Fetching: rake-10.3.2.gem ( 21%)
Fetching: rake-10.3.2.gem ( 23%)
Fetching: rake-10.3.2.gem ( 25%)
Fetching: rake-10.3.2.gem ( 37%)
Fetching: rake-10.3.2.gem ( 49%)
Fetching: rake-10.3.2.gem ( 62%)
Fetching: rake-10.3.2.gem ( 74%)
Fetching: rake-10.3.2.gem ( 86%)
Fetching: rake-10.3.2.gem ( 99%)
Fetching: rake-10.3.2.gem (100%)
Fetching: rake-10.3.2.gem (100%)
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory @ rb_sysopen - /opt/jenkins/.gem/ruby/2.4.0/cache/rake-10.3.2.gem
我该如何解决?我如何获得
答案 0 :(得分:1)
将红宝石和耙子安装为宝石。
apk add ruby && gem install rake
您也可以使用ruby / 2.4-alpine作为基本映像,以避免手动安装ruby。
FROM ruby/2.4-alpine
RUN gem install rake