0
0
Ruby on Railsframework~10 mins

Docker deployment in Ruby on Rails - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the base image for a Rails app Dockerfile.

Ruby on Rails
FROM [1]
Drag options to blanks, or click blank then click option'
Aubuntu:20.04
Bnode:14
Cpython:3.12
Druby:3.2
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a Node or Python image instead of Ruby.
Using a generic OS image without Ruby installed.
2fill in blank
medium

Complete the code to copy the Gemfile into the Docker image.

Ruby on Rails
COPY [1] /usr/src/app/Gemfile
Drag options to blanks, or click blank then click option'
AGemfile
Bapp
CDockerfile
Dconfig
Attempts:
3 left
💡 Hint
Common Mistakes
Copying the wrong directory or file.
Copying the Dockerfile instead of Gemfile.
3fill in blank
hard

Fix the error in the command to install gems in the Dockerfile.

Ruby on Rails
RUN bundle [1]
Drag options to blanks, or click blank then click option'
Ainstall
Bupdate
Cremove
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using bundle update which updates gems but does not install missing ones.
Using bundle remove which removes gems.
4fill in blank
hard

Fill both blanks to expose the correct port and set the working directory.

Ruby on Rails
EXPOSE [1]
WORKDIR [2]
Drag options to blanks, or click blank then click option'
A3000
B/app
C/usr/src/app
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing port 8080 which is not default for Rails.
Setting working directory to a non-standard path.
5fill in blank
hard

Fill all three blanks to run the Rails server with the correct command and environment.

Ruby on Rails
CMD ["rails", "[1]", "-b", "0.0.0.0", "-e", "[2]", "-p", "[3]"]
Drag options to blanks, or click blank then click option'
Aserver
Bproduction
C3000
Dconsole
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'console' instead of 'server' to start Rails.
Setting environment to 'development' instead of 'production'.
Using wrong port number.