Docker: Ruby version upgrade from 2.2.0 to 2.4.0

I am using Ruby version 2.2.0 in my Rails Application and Rails version is 4.2.0.
Currently, Project is built through docker, so I am thinking of to upgrade the ruby version with 2.4.0 version.

I believe I need to change the docker image to upgrade the ruby version.

I already check a few of the articles but didn’t get enough information.

Docker file

FROM ruby:2.2.0

RUN apt update && 
  apt install -y --no-install-recommends 
  git 
  curl 
  gnupg2 
  libpq-dev 
  libmysqlclient-dev 
  nodejs 
  graphviz 
  && rm -rf /var/lib/apt/lists/*

Once ruby version upgraded then I will upgrade the rails version.
Any help will be appreciated.

Source: StackOverflow