Commit doesn't work

Expected behavior

Should save the changes of the container

Actual behavior

Doesn’t save anything.

Information

When I commit the changes after successfully installing json gem,

json gem is not installed in the saved image.

Steps to reproduce the behavior

  1. run
docker run -t -i training/sinatra /bin/bash

sudo su

apt-get install curl

curl -#LO https://rvm.io/mpapis.asc 

gpg --import mpapis.asc

curl -sSL https://get.rvm.io | bash -s stable

source /etc/profile.d/rvm.sh

rvm requirements

rvm list known

rvm install 2.3.0

rvm use 2.3.0 --default

ruby --version

gem install json
  1. commit the above container using docker commit.

  2. run the saved image.

  3. try gem install json … it says it needs ruby version > 2.0, but ruby version 2.3 was previously installed before committing.