我正在处理一个 docker 文件以在Codenvy上创建一个自定义工作区。当我创建工作区时,一切似乎都安装正确,但是当工作区打开并输入时,ruby -v
我得到:
bash: ruby: command not found
导轨也一样:
user@de98ec223612:/projects$ rails -v
bash: rails: command not found
如果我输入 rvm list 我得到
user@de98ec223612:/projects$ rvm info
ruby-2.4.0:
system:
uname: "Linux de98ec223612 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux"
name: "Ubuntu"
version: "16.04"
architecture: "x86_64"
bash: "/bin/bash => GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
remote path: "ubuntu/16.04/x86_64"
rvm:
version: "rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]"
updated: "5 minutes 31 seconds ago"
path: "/home/user/.rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.4.0p0"
date: "2016-12-24"
platform: "x86_64-linux"
patchlevel: "2016-12-24 revision 57164"
full_version: "ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]"
homes:
gem: "/home/user/.rvm/gems/ruby-2.4.0"
ruby: "/home/user/.rvm/rubies/ruby-2.4.0"
binaries:
ruby: "/home/user/.rvm/rubies/ruby-2.4.0/bin/ruby"
irb: "/home/user/.rvm/rubies/ruby-2.4.0/bin/irb"
gem: "/home/user/.rvm/rubies/ruby-2.4.0/bin/gem"
rake: "/home/user/.rvm/rubies/ruby-2.4.0/bin/rake"
environment:
PATH: "/home/user/.rvm/gems/ruby-2.4.0/bin:/home/user/.rvm/gems/ruby-2.4.0@global/bin:/home/user/.rvm/rubies/ruby-2.4.0/bin:/usr/lib/jvm/java-1.8.0-open
jdk-amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bundle/bin:/usr/lib/postgresql/9.6/bin:/home/user/.rvm/bin"
GEM_HOME: "/home/user/.rvm/gems/ruby-2.4.0"
GEM_PATH: "/home/user/.rvm/gems/ruby-2.4.0:/home/user/.rvm/gems/ruby-2.4.0@global"
MY_RUBY_HOME: "/home/user/.rvm/rubies/ruby-2.4.0"
IRBRC: "/home/user/.rvm/rubies/ruby-2.4.0/.irbrc"
RUBYOPT: ""
gemset: ""
在我看来,东西安装正确。
如果我键入/home/user/.rvm/rubies/ruby-2.4.0/bin/ruby -v
它会显示正确的 ruby 版本。 /home/user/.rvm/rubies/ruby-2.4.0/bin
在 PATH 为什么不被搜索?
如果有帮助,这是我的 docker 文件的相关部分。
# Install RVM
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB &&\
echo progress-bar >> ~/.curlrc &&\
\curl -sSL https://get.rvm.io | bash -s stable &&\
/bin/bash -l -c 'source ~/.rvm/scripts/rvm'
# Install Ruby
RUN /bin/bash -l -c 'rvm requirements' &&\
/bin/bash -l -c 'rvm install ${RUBY_VERSION}' &&\
/bin/bash -l -c 'rvm use ${RUBY_VERSION} --default' &&\
/bin/bash -l -c 'rvm rubygems current'
# Install bundler
RUN /bin/bash -l -c 'gem install bundler'
# Install Rails
RUN /bin/bash -l -c 'gem install rails'
RUN echo $PATH
EXPOSE 3000
WORKDIR /projects
CMD /bin/bash -l -c 'source ~/.rvm/scripts/rvm' && sudo service postgresql start && tail -f /dev/null
我怎样才能让这些命令在不使用的情况下运行/home/user/.rvm/rubies/ruby-2.4.0/bin
?