使用rbenv与Docker [英] Using rbenv with Docker

查看:350
本文介绍了使用rbenv与Docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to setup rbenv with a Dockerfile, but this just fails on rbenv install. I do have ruby-build in there, it just doesn't seem to work.

Dockerfile的相关位(大部分从 https://gist.github.com/deepak/5925003 ):

Relevant bits of the Dockerfile (largely lifted from 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


推荐答案

您缺少 ruby​​-build 的设置步骤:您需要运行其 install.sh 克隆后。

You're missing a setup step for ruby-build: You need to run its install.sh after you cloned it.

这篇关于使用rbenv与Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆