Quick Recap

Let's review what we have learned so far.

Highlights

Now that you have had your first taste of Docker, let’s review what we have learned.

  1. We ran our first ever Docker command—a helloworld Ruby script—without needing Ruby installed in our environment by using:

    $ docker run ruby:2.7 ruby -e "puts :hello" 
    
  2. We saw how to list our running containers with docker ps and all containers (including stopped ones) with docker ps -a.

  3. We deleted old containers with docker rm <container id> and saw how to create throwaway containers using the docker run’s --rm option.

  4. We generated a new Rails project using a container by:

    • starting an interactive Bash shell running inside a container by using:

      $ docker run -i -t --rm -v ${PWD}:/usr/src/app ruby:2.7 bash 
      
    • installing the Rails gem inside the container by gem install rails

    • using the freshly installed Rails gem to generate our project with

      $ rails new myapp --skip-test \ --skip-bundle
      

Nice. ✨ We are well on our way to Docker proficiency.

What to expect in the next chapter?

In the next chapter, we will learn how to run our new Rails application.

Get hands-on with 1400+ tech skills courses.