March 12, 2025
Are you looking for a quick and efficient way to set up a complete Ruby on Rails development environment? With Docker, you can have a fully functional Rails stack—including PostgreSQL and all necessary configurations—up and running in just a few commands!
For those interested in exploring how to Dockerize a Ruby on Rails application, I’ve shared the code in this GitHub repository:
Why Use Docker for Rails Development?
Setting up a Rails environment can sometimes be cumbersome, with dependency issues and system conflicts slowing you down. Docker simplifies this process by creating a containerized environment where everything is pre-configured and isolated. That means:
- No more dependency conflicts.
- Easy onboarding for new developers.
- Consistent development and production environments.
Do you need to optimize and automate your project?
Let’s work together and take your project to the next level!
Get Started in Just a Few Commands
With this setup, you can have Rails, PostgreSQL, and all necessary connections running effortlessly:
git clone git clone git@github.com:ggerman/ruby_on_rails_dockerized.git
cd repository-name
./bin/start.sh up
This script will:
- Build the necessary Docker containers.
- Set up PostgreSQL and MailCatcher.
- Install dependencies (bundle install, yarn install).
- Set up the database (db:create, db:migrate).
Once this is complete, you’re ready to start coding!
Features of This Setup
- Pre-configured PostgreSQL Database : No need to install and configure manually.
- MailCatcher for Email Testing : Easily capture and preview emails sent from your app.
- Seamless Development Experience : Access the Rails console, database, and test suite within the container.
Running Tests
To ensure everything is working correctly, run your test suite with a single command:
./bin/test.sh
For individual tests:
./bin/test.sh spec/model/post_spec.rb:22
Keeping Your Environment Updated
If you make changes to your Docker setup, simply rebuild the environment:
./bin/start.sh build
Contribute and Improve
This project welcomes contributions! If you’d like to improve or extend this environment:
- Fork the repository.
- Create a new branch: git checkout -b feature/your-feature
- Commit your changes: git commit -am ‘Add some feature’
- Push to the branch: git push origin feature/your-feature
- Open a pull request.
Need Expert Ruby on Rails Developers to Elevate Your Project?
Need Expert Ruby on Rails Developers to Elevate Your Project?
Final Thoughts
Using Docker for Rails development removes a lot of the common headaches, allowing you to focus on what really matters—building great applications. Give it a try, and let me know your thoughts!
Top comments (0)