Docker Basics : Rebuilding Images


We will upgrade Ruby and Learn how to rebuild images.


Step 1

Change the Ruby version in Dockerfile:


You can see all the available tags for Ruby here:

Step 2

$ docker build -t bparanj/hello .

This will rebuild the image. When you run the app you will see the Ruby version is 2.2.2.

Step 3

You can also check the list of images by doing:

$ docker images

Step 4

You can verify the Ruby version by going into the container:

$ docker run -i -t bparanj/hello /bin/bash
root@0503074f21c9:/app# ruby -v

You will see:

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

You can download the code from here:


In this article, we saw how we can upgrade Ruby by specifying the Ruby version in the Dockerfile and rebuilding the image.

Related Articles

Create your own user feedback survey