I'm attempting to build a Dockerfile with multiple versions of Ruby to allow dynamic switching, but I think I'm hitting a shell interactivity problem.
Dockerfile:
FROM renovate/base
USER root
RUN apt-get update && apt-get install -y build-essential
RUN cd /tmp && \
curl -L https://github.com/postmodern/ruby-install/archive/v0.7.0.tar.gz > ruby-install-0.7.0.tar.gz && \
tar -xzvf ruby-install-0.7.0.tar.gz && \
cd ruby-install-0.7.0/ && \
make install
RUN ruby-install ruby
RUN chmod -R a+rw /usr
USER ubuntu
RUN cd /tmp && curl -L https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz > chruby-0.3.9.tar.gz && \
tar -xzvf chruby-0.3.9.tar.gz && \
cd chruby-0.3.9/ && \
make install
RUN echo "source /usr/local/share/chruby/chruby.sh" >> ~/.bashrc
Logs:
~/github/docker-bundler master*
❯ docker run --rm -it renovate/bundler chruby
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"chruby\": executable file not found in $PATH": unknown.
~/github/docker-bundler master*
❯ docker run --rm -it renovate/bundler bash -l -c chruby
bash: chruby: command not found
~/github/docker-bundler master*
❯ docker run --rm -it renovate/bundler bash
ubuntu@fbbaebe9ed05:/$ chruby
ruby-2.6.0
ubuntu@fbbaebe9ed05:/$
As you can see, chruby runs once I explicitly run a bash session, but it doesn't run when called directly or even indirectly via bash. I guess it's something to do with aliases and shell interactivity?
I'm attempting to build a Dockerfile with multiple versions of Ruby to allow dynamic switching, but I think I'm hitting a shell interactivity problem.
Dockerfile:
Logs:
As you can see,
chruby
runs once I explicitly run a bash session, but it doesn't run when called directly or even indirectly viabash
. I guess it's something to do with aliases and shell interactivity?Any help would be appreciated.