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?

  • dockerize a python/jinja2 program to generate a pdf document
  • connecting APIMAN to an external ElasticSearch database for metrics
  • Running Gatling from docker-compose
  • maven-release-plugin automatically run a script before commit
  • Remove docker images and containers that are taking disk space
  • Is there an Apache Spark 2.0.0 public Docker image suitable for multi-node clustered deployment? [closed]
  • 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.

  • 'service docker status' fails: invalid arguments
  • How to run linux command before starting up git bash terminal
  • MySQL Docker container is not saving data to new image
  • How to extend the scope of Docker Macvlan driver from Local to Swarm
  • Wrong password with basic auth and docker features from traefik 1.3.0
  • Could not access a running Docker Image of War (with tomcat) in minishift - OpenShift-Origin
  • 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 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.