How to change Ruby and Rails version for the Rails base Docker image?

Docker base image rails provides a full environment for Ruby on Rails. It pulls from the ruby upstream image. The rails base image specifies Ruby and Ruby on Rails versions.

What if we want to use different Ruby and Ruby on Rails versions?

  • Storage requirement when using for AWS ECS
  • Weird error when using protractor-headless image
  • Defining services in kubelet manifest
  • How to use a separate file system for the Docker daemon related files at start up on AWS EC2
  • How to add a mount on a docker swarm service with the specified owner
  • How to connect to docker container in local machina [duplicate]
  • Do we edit our Dockerfile in our project folder? Or, do we ssh into the machine, and install the ruby version we want and then build our own image?

    Further details:

    The rails base image documentation says that your doc file can simply be one line of code:

    FROM rails:onbuild
    

    This line of code pulls from the rails image on Docker Hub. This image has its own Dockerfile. The first line of this Dockerfile is FROM ruby:2.2.

    Just to restate the question, what is the best way to create a container based off of the rails image, with different Ruby and Ruby on Rails versions? If possible, some sample code might be helpful for understanding how to do this.

  • systemtap:while resolving probe point: identifier 'process' at source: probe process().function no match
  • What are the advantages of docker containers over statically linked EXEs?
  • docker-compose 1.6 “args” attribute on “build”
  • How to find Docker container's layer ID and reuse it in another container
  • Installing a .exe on a windows container
  • tcpdump reports error in Docker container that's started with --privileged
  • One Solution collect form web for “How to change Ruby and Rails version for the Rails base Docker image?”

    I assume you want a docker image that is suiteable for plenty of rails apps.

    I do not know docker at all, but maybe ignore what Docker offers to you, and do it yourself:

    Create an image with all great ruby versions, maybe 1.9 and 2.3,
    but i think you should just stick with latest ruby.

    Use https://github.com/rbenv/rbenv to provide a ruby env

    Every Rails applications usually ships with a Gemfile.
    In production releases, the gem versions are locked in the Gemfile.lock file.

    In case the gems need an update, you will need to update the app code and then the gems with

    bundle install
    

    So i think it´s not possible to have a docker “one-fits-all” image for plenty of rails apps nicely.

    Something i do when installing productive rails apps is to install their gems in the app folder.

    bundle install --path vendor/bundle
    

    This puts the gem apps inside their vendor directory. I see no big chance here either to make update life easier.


    As i never tried docker, or even visited their website, my post might be useless (sry)
    I hope i understood your intentions, at least.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.