Reputation: 8986
I'm trying to install rbenv in a centos container using this tutorial. When i run these commands in bash myself they work but when using docker build i get the error below.
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
output
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
What am I doing wrong?
Upvotes: 2
Views: 817
Reputation: 32156
Your source command is in a RUN, so it is forgotten in the next command
Upvotes: 1