Entering the following commands in a terminal in your desktop Linux system:
cdcd rubyonracetracks
cd docker-debian-buster-use # Back to the directory for using Docker images
Enter the command "ls" to see the available scripts.
Enter the following command to create the files for using a Docker container based on the rvm-rails-general Docker image:
sh rvm-rails-general.sh
You will be asked about your desired offset for the port numbers. Enter "10".
Enter the following command to enter the directory for using the rvm-rails-general image:
cd rvm-rails-general
Enter the command "ls". Note that this "rvm-rails-general" directory contains scripts for using the rvm-rails-general Docker image. Again, these scripts come with important parameters already filled in for you.
Enter the command "ls shared". You can see the files within the shared directory.
Download the rvm-rails-general Docker image and start a Docker container based on it by entering the following command:
sh download_new_image.sh
The rvm-rails-general Docker image will be downloaded, and a corresponding Docker container will be created. When the new Docker container is ready, you will be automatically logged in.
When you are in the Docker container, enter the command "exit" to return to your desktop Linux system.
Time Stamp
Enter the command "sh reset.sh".
Note that the time stamp file has four build dates. That's because the rvm-rails-general Docker image is a derivative of the min-rvm image, which is a derivative of the min-stage2 image. The min-stage2 image is a derivative of the min-stage1 image.
Information
Enter the command "sh info.sh". You'll see that least one version of Ruby was installed with RVM, and at least one version of Rails was installed as well.
Note the port forwarding information, which is stored in the ports.txt file in the shared directory. You'll see that port 3000 in Docker corresponds to port 3010 in the desktop Linux system. Additionally, port 5432 in Docker correspeonds to port 15442 in the desktop Linux system.
Removing and Restoring Ruby on Rails
Enter the command "rvm list". You'll see the versions of Ruby pre-installed with RVM.
Enter the command "ruby -v". This shows you the version of Ruby currently in use.
Enter the command "rails -v". This shows you the version of Rails currently in use.
Enter the command "rm -rf /home/winner/.rvm". This removes RVM, all versions of Ruby installed with RVM, and Rails (which was installed within Ruby).
Enter the command "rvm list". You'll error messages telling you that certain RVM files cannot be found.
Enter the command "ruby -v". You'll get an error message telling you that the Ruby file cannot be found.
Enter the command "rails -v". You'll get an error message telling you that the Rails file cannot be found.
Enter the command "exit".
Enter the command "sh resume.sh".
Enter the command "rvm list". You'll get the error message "command not found".
Enter the command "ruby -v". You'll get the error message "command not found".
Enter the command "rails -v". You'll get the error message "command not found".
Enter the command "exit".
Enter the command "sh reset.sh".
Enter the command "rvm list". You'll see the versions of Ruby pre-installed with RVM.
Enter the command "ruby -v". Now you'll see that Ruby is back.
Enter the command "rails -v". Now you'll see that Rails is back.
Enter the command "exit".
If you had deleted Ruby on Rails from a host system, it would take you hours to fully reinstall it. In the next chapter, you will create a very basic Ruby on Rails app.