The Ruby installer says to run ‘source /usr/local/rvm/scripts/rvm’ as a way to enable the environment for rvm but with Docker this gives an error indicating that ‘source’ is a bash builtin. Using the sh equivalent to run a script, you also get an error,
Step 4 : RUN . /usr/local/rvm/bin/rvm ---> Running in 534f12b27222 /bin/sh: 7: /usr/local/rvm/bin/rvm: Syntax error: "(" unexpected (expecting "fi")
This is because the RUN operation uses /bin/sh to execute tasks
RUN /bin/bash -c "source /usr/local/rvm/scripts/rvm \ && gem update --system --no-rdoc --no-ri \ && gem update --no-rdoc --no-ri \ && gem install --no-rdoc --no-ri bundler \ && gem install --no-rdoc --no-ri libv8 \ && gem install --no-rdoc --no-ri mysql2"
The whole operation has to be run inside the quotes, you can’t the source as one RUN and the gem commands as individual RUNs, you’ll get a ‘gem: command not found’ error.