Running a Ruby Script Without Ruby Installed
In this lesson, we will go through some Docker commands.
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 Options UntitledConcept1 - 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 following statement:
$ docker run ruby:2.7 ruby -e "puts :hello"
Try to connect the terminal and see the result of this command in action.
Get hands-on with 1300+ tech skills courses.