title: Run ruby script in docker with installed gems
body: <p>What would be a quick way to run a ruby script that needs a few gems within a docker container?</p>
  
  <p>I often come across the situation where I want to try out a new gem, or write a short script, and I don't want to install the gem locally. My first idea was to write a <code>Dockerfile</code> and build the image, e.g.</p>
  
  <pre><code>FROM ruby:latest
  
  RUN gem install httparty
  COPY test.rb /usr/app/
  
  CMD ["ruby", "/usr/app/test.rb"]
  </code></pre>
  
  <p>and <code>test.rb</code></p>
  
  <pre><code>require "httparty"
  puts HTTParty.get("https://now.httpbin.org/").body
  </code></pre>
  
  <p>Then run <code>docker build -t run-ruby-with-gems .</code> and after the build <code>docker run -it --rm run-ruby-with-gems</code></p>
  
  <p>This works, but isn't handy. So maybe there is some smart one liner or anything else that could make the whole process of quickly running a ruby script easier.</p>