Ruby Installation in a Docker container

I installed ruby through rvm using these commands:
curl -sSL | bash -s stable --without-gems="rvm rubygems-bundler" \ --with-gems="kubeclient" && \ bin/bash -l -c "rvm requirements" && \ bin/bash -l -c "rvm install 2.4" && \ /bin/bash -l -c "rvm use 2.4 --default" && \ /bin/bash -l -c "gem install kubeclient" && \
along with other things but in the original single RUN command but the size seems to have doubled.

However if I install it after it’s been built with the same commands in the container, it doesn’t increase in size as much.

try to do a docker history YOUR_IMAGE_ID. This allows you to see how much space each layer is using.