8

我正在尝试使用 Dockerfile 设置 rbenv,但这只是在rbenv install. 我确实有 ruby​​-build 在那里,它似乎不起作用。

Dockerfile 的相关部分(主要来自https://gist.github.com/deepak/5925003):

# Install rbenv
RUN git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
RUN echo '# rbenv setup' > /etc/profile.d/rbenv.sh
RUN echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
RUN echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
RUN chmod +x /etc/profile.d/rbenv.sh

# install ruby-build
RUN mkdir /usr/local/rbenv/plugins
RUN git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build

ENV PATH /usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Set to Ruby 2.0.0-p247
RUN rbenv install 2.0.0-p247
RUN rbenv rehash
RUN rbenv local 2.0.0-p247

错误:

Step 21 : RUN rbenv install 2.0.0-p247
 ---> Running in 8869fa8f0651
rbenv: no such command `install'
Error build: The command [/bin/sh -c rbenv install 2.0.0-p247] returned a non-zero code: 1
The command [/bin/sh -c rbenv install 2.0.0-p247] returned a non-zero code: 1
4

2 回答 2

5

您缺少以下设置步骤ruby-build:您需要install.sh在克隆后运行它。

于 2013-09-20T23:08:42.463 回答
0

如果您只需要一个 Ruby 版本,只需使用官方 Ruby 镜像:https ://hub.docker.com/_/ruby

于 2020-03-05T21:04:02.607 回答