Generating a New Rails App Without Ruby Installed
Familiarize yourself with using Docker for some real-world tasks.
We'll cover the following...
Interactive Bash shell
We need to run multiple commands in succession in a container in order to generate the Rails project. We could craft a really long, ugly docker run
that executes instructions one after another. However, that’s going to be hard to comprehend.
Instead, we can start a container running an interactive Bash shell. This will provide us with a terminal session running inside the container. From there, we can run as many commands as we like, much as if we had a local Bash session.
Note: All the options and commands used below will be explained and run in the later section of the lesson.
We are now going to start an interactive Bash shell inside a container based on the familiar ruby:2.7
image:
$ docker run -i -t --rm -v ${PWD}:/usr/src/app ruby:2.7 bash
The option --rm
creates a throwaway container ...