title: Ruby setup in docker
body: <p>I need to get a docker image with ruby>=2.5 installed, and then run <code>bundle exec rake test</code> in the container. I know that could be simply accomplished by using the official <a href="https://hub.docker.com/_/ruby" rel="nofollow noreferrer">docker ruby image</a> but due to licensing restrictions I cannot do that.</p>
  
  <p>So, what I have to work with is an <a href="https://github.com/GoogleCloudPlatform/ruby-docker" rel="nofollow noreferrer">image with rbenv pre-configured</a>. After much trial and error I've arrived at the following dockerfile:</p>
  
  <pre><code>FROM launcher.gcr.io/google/ruby:latest
  
  RUN rbenv install 2.5.7
  RUN rbenv rehash
  RUN rbenv global 2.5.7
  
  COPY ./ /my-app
  WORKDIR /my-app
  RUN gem install bundler
  RUN bundle install
  ENTRYPOINT bundle exec rake test
  </code></pre>
  
  <p>I build it with <code>docker build -f dockerfile.tests . -t tests</code> and then run with <code>docker run -i tests</code> and what I get is:</p>
  
  <pre><code>/usr/bin/env: 'ruby2.5': No such file or directory
  </code></pre>
  
  <p>Any ideas of what could be wrong here? Thank you!</p>
  
  <p>ps. I've tried the same with RVM and the end result was exactly the same error. Also tried (initially) to install ruby 2.5 with <code>apt install</code> but the latest version available via apt is 2.3.</p>