Search⌘ K
AI Features

Running a Ruby Script Without Ruby Installed

Explore how to use Docker to run Ruby scripts without having Ruby installed on your local machine. Learn the docker run command syntax, how images provide preinstalled environments, and managing containers including cleaning up stopped containers. This lesson helps you confidently execute Ruby code inside Docker containers and maintain a tidy workspace.

Basic command

Let’s write our first Docker command using the following format.

docker run [OPTIONS] <image> <command>

Below are some details about the command:

  • The word docker is used before every docker command.
  • To start a new container run is used based on an image, and to execute commands inside the container.
  • The [OPTIONS] are used to define additional usage along with the start of the container. Click here for more details on OptionsUntitledConcept1
  • The <image> is to be replaced with the name of an image.
  • The <command> specifies what we want to run inside the container.

Ruby command

Next, we will use Docker to run a Ruby application without Ruby installed on our system. For this, we will use the ...