I want to install rbenv on Docker which seems to work but I can't reload the shell.
FROM node:0.10.32-slim
RUN \
apt-get update \
&& apt-get install -y sudo
RUN \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& groupadd r \
&& useradd r -m -g r -g sudo
USER r
RUN \
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv \
&& echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc \
&& echo 'eval "$(rbenv init -)"' >> ~/.bashrc
RUN rbenv # check if it works...
When I run this I get:
docker build .
..
Step 5 : RUN rbenv
/bin/sh: 1: rbenv: not found
From what I understand, I need to reload the current shell so I can install ruby versions. Not sure if I am on the right track.
Also see: Using rbenv with Docker
I'm not sure how Docker works, but it seems like maybe you're missing a step where you
source ~/.bashrc, which is preventing you from having therbenvexecutable in yourPATH. Try adding that right before your first attempt to runrbenvand see if it helps.You can always solve
PATHissues by using the absolute path, too. Instead of justrbenv, try running$HOME/.rbenv/bin/rbenv.If that works, it indicates that rbenv has installed successfully, and that your
PATHis not correctly set to include itsbindirectory.It looks from reading the other question you posted that docker allows you to set your
PATHvia anENV PATHcommand, like this, for example:but you should make sure that you include all of the various paths you will need.