使用 Dockerfile 的错误 运行 命令
Error running commands with Dockerfile
我正在尝试使用 this tutorial 在 centos 容器中安装 rbenv。
当我 运行 这些命令在 bash 我自己时它们工作但是当使用 docker build 我得到下面的错误。
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
我做错了什么?
你的源命令在运行中,所以在下一个命令中忘记了
我正在尝试使用 this tutorial 在 centos 容器中安装 rbenv。 当我 运行 这些命令在 bash 我自己时它们工作但是当使用 docker build 我得到下面的错误。
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
我做错了什么?
你的源命令在运行中,所以在下一个命令中忘记了