我正在處理docker文件以在Codenvy上創建自定義工作區。當我創建工作區一切似乎正確安裝,但工作區時開放,我進入ruby -v
我得到:在Docker上使用RVM安裝Ruby和Rails「路徑未找到」
bash: ruby: command not found
同爲軌道:
[email protected]:/projects$ rails -v
bash: rails: command not found
如果鍵入RVM名單,我得到
[email protected]:/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/[email protected]/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/[email protected]"
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中爲什麼不被搜索?
這是我的碼頭文件的相關部分,如果有幫助。
# 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起到任何幫助將是非常讚賞。
忘了提。我在/ opt中安裝rvm。 – user3256848