Ruby on Whales
July 24, 2026 ยท View on GitHub
This repository contains an example dockerized Ruby on Rails development configuration based on the Ruby on Whales blog post.
This project is built by Evil Martians, an American design and engineering consultancy for developer tools, AI, and cybersecurity startups.
Example configuration
See the example folder.
Interactive generator
We also provide an interactive generator for Rails apps to quickly setup a dockerized environment for your app. Just run the following command and follow the instructions:
bundle exec rails app:template LOCATION='https://railsbytes.com/script/z5OsoB'
You can also run it via Ruby Bytes (so you can dockerize a Rails app without installing it on your host machine):
rbytes install https://railsbytes.com/script/z5OsoB
Tips & Tricks
Pry / IRB history support
To persiste Pry or IRB history, you must configure them to store it in the history volume.
For IRB, add the following to your .irbrc file:
IRB.conf[:SAVE_HISTORY] = 10_000 # Maximum number of lines to save in history
IRB.conf[:HISTORY_FILE] = ENV.fetch("IRB_HISTFILE", "#{ENV["HOME"]}/.irb-history")
Then, in the compose.yml, specify the IRB_HISTFILE environment variable:
x-backend:
environment:
# ...
IRB_HISTFILE: /usr/local/hist/.irb_history
Similarly, for Pry, add the following to your .pryrc file:
Pry.config.history_save = true
Pry.config.history_file = ENV.fetch("PRY_HISTFILE", "#{ENV["HOME"]}/.pry-history")
Then, in the compose.yml, specify the PRY_HISTFILE environment variable:
x-backend:
environment:
# ...
PRY_HISTFILE: /usr/local/hist/.pry_history
See also
- System of a test (setting up system tests with Docker)
- Vite-alizing Rails (more about using Vite with Rails and Docker)
- Faster RuboCop runs for Rails
- Terraforming Rails
License
The code is available as open source under the terms of the MIT License.