使用Dockerfile运行命令时出错

我试图安装rbenv在一个centos容器使用本教程 。 当我在bash自己运行这些命令时,他们工作,但是当使用docker生成我得到下面的错误。

FROM centos:latest RUN yum install -y sudo git vim git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel RUN cd RUN git clone git://github.com/sstephenson/rbenv.git .rbenv RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile RUN echo 'eval "$(rbenv init -)"' >> ~/.bash_profile RUN exec $SHELL RUN git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build RUN echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile RUN exec $SHELL RUN source ~/.bash_profile RUN rbenv install -v 2.2.1 RUN rbenv global 2.2.1 RUN echo "gem: --no-document" > ~/.gemrc RUN gem install bundler 

产量

 Step 9 : RUN exec $SHELL ---> Running in 021180fff90b ---> 62ed2f1faaa6 Removing intermediate container 021180fff90b Step 10 : RUN source ~/.bash_profile ---> Running in 89e10052c73b /root/.bash_profile: line 14: rbenv: command not found ---> f819228f98c2 Removing intermediate container 89e10052c73b Step 11 : RUN rbenv install -v 2.2.1 ---> Running in a4304fe37e18 /bin/sh: rbenv: command not found The command '/bin/sh -c rbenv install -v 2.2.1' returned a non-zero code: 127 

我究竟做错了什么?

你的源代码命令是在一个RUN中,所以在下一个命令中被遗忘了