Rails 8 Development with Dev Containers and rails-new @StatelessCode
Rails 8 Development with Dev Containers and rails-new  @StatelessCode
Uploaded January 2025 | Updated September 2026, 3 weeks ago
For beginning programmers or seasoned programmers trying out a new language or framework, setting up the development environment can be a cause of frustration and perhaps even a barrier to entry. For teams, variance between development environment setups can reduce productivity and increase risk.

Programmers want to spend their time actually coding instead of installing and configuring software that enables them to code.

Development containers (or dev containers) provide a promising solution to the problem that can allow for an environment to be configured once and then shared with everybody working on the project.

In this video we apply dev containers to the problem of creating a new Ruby on Rails 8 project. We use the rails-new binary to generate a dev container so that you don't even need to have Ruby installed on your host system.

There are a couple of things to watch out for with rails-new:
- The default versions is uses as-of January 2025 are Ruby 3.3.4 and Rails 7.2.2 (which won't help you for Rails 8 development)
- The placement of arguments in rails-new matters. The verions flags must be before the name of the Rails app

BAD (will use Ruby 3.3.4 and Rails 7.2.2)
rails-new storedevc --devcontainer -u 3.4.1 -r 8.0.1

GOOD
rails-new -u 3.4.1 -r 8.0.1 storedevc --devcontainer

There are trade-offs compared to developing natively on your system. Dev containers use far more storage per project because each container has its own sandboxed operating system.

This video covers:
00:00:00 Introduction
00:03:07 Discussion of trade-offs and look at beginning of Getting Started with Dev Containers guide
00:04:26 Exploration of Docker documentation. Already installed, verify version.
00:05:54 Install rails-new binary
00:09:57 Discuss rails-new and show defaults
00:12:15 Invoke rails-new command with Ruby and Rails version arguments in the wrong place (builds wrong version)
00:14:30 Explain error, remove incorrect docker image
00:16:30 Retry rails-new command with arguments in correct place
00:18:00 Review output of successful rails-new command
00:18:57 Open directory in Visual Studio Code and follow prompt to reopen in container
00:20:22 Explore dev container and compare against local development
00:22:45 Discussion of using dev containers for contributing to Rails

#ruby #rails8 #rails #rubyonrails #railsnew #devcontainers #codecast #screencast #github #opensource #minitest #TDD #agile #softwaredevelopment #learntocode

See other related StatelessCode videos:
- Install Ruby and Rails with Databases on Ubuntu 24.04 youtu.be/XB6lPKAzRxc
- Install Node.js (versions 18, 20, 22) with NVM on Ubuntu 24.04 youtu.be/YyEf1QWfg9Y
- Install Visual Studio Code on Ubuntu 24.04 youtu.be/GdmHY1JhLI8

Featured Playlist:
- Create a RubyGem: NerdDice youtube.com/playlist?list=PL9kkbu1kLUeOnUtMpAnJOCtHdThx1Efkt

Resources that we relied upon for this solution:
- Development Containers https://containers.dev/
- Getting Started with Dev Containers Rails Guide guides.rubyonrails.org/getting_started_with_devcontainer.html
- Docker Docs docs.docker.com
- rails-new github.com/rails/rails-new

This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
Rails 8 Development with Dev Containers and rails-newReview a Pull Request from Our Devise Tailwind Video: Rails Helpers or Tailwind Directives?The Way of the Waveform - How I Trimmed 30 Minutes of Dead Air from a Coding Video with OpenShotInkscape 06: Rework the Stateless Code Logo and Make a Nerdy DieCodecast: Getting Started with Rails 7 22: Broadcast Comment Changes to the Article with Turbo300 Videos! 300 Badges!Create a RubyGem 96: Drop Official Support for End-of-Life Ruby 2.7Set up a Salesforce Development Environment on Ubuntu 24.04Why Do Your Own User Experience Research?Codecast: statelesscode.com WordPress 03: Install WP Test Dataset and Create Theme off of Sage 10Get Rails System Tests Working with GitHub ActionsThe Path to Rails 8 - Upgrade Ruby from 3.2 to 3.4 on Rails 7.0
Stateless Code |

Rails 8 Development with Dev Containers and rails-new

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER