GAURAV VARMA
Rails 7.1 now ships with default Docker configuration for every new app, making containerization and deployment to production easier, faster, and consistent across environments.
What’s included?
When you run:
1rails new myapp
Rails will generate:
Dockerfile
.dockerignore
bin/docker-entrypoint
These files serve as a production-ready Docker setup to help you ship your Rails app with confidence.
⚠️ Note: These files are optimized for deployment, not local development.
Run your app with Docker
Here’s how you can containerize and run your new app using the generated config:
1docker build -t blog-app .
2docker volume create app-storage
3docker run --rm -it -v app-storage:/rails/storage -p 3000:3000 --env RAILS_MASTER_KEY=<your-master-key> blog-app
Want to start a Rails console?
1docker run --rm -it -v app-storage:/rails/storage --env RAILS_MASTER_KEY=<your-master-key> blog-app console
Building Multi-platform Images
Deploying to Apple Silicon, Intel, or ARM? Rails makes it easy to prepare your app for any architecture:
1docker login -u <your-docker-username>
2docker buildx create --use
3docker buildx build --push --platform=linux/amd64,linux/arm64 -t <your-user/image-name> .
Bonus: Docked CLI for local dev
If you want to bootstrap a Rails app without worrying about system dependencies, try docked
. It uses a pre-built Docker image for a smooth Rails experience:
1docker volume create ruby-bundle-cache
2alias docked='docker run --rm -it -v ${PWD}:/rails -v ruby-bundle-cache:/bundle -p 3000:3000 ghcr.io/rails/cli'
3
4docked rails new blog-app
5cd blog-app
6docked rails generate scaffold post title:string body:text
7docked rails db:migrate
8docked rails server
No local Ruby or Node setup needed — just Docker.
Links
Summary
Rails 7.1 adds first-class Docker support for new apps. You get ready-to-use Dockerfiles, production-ready entrypoints, and a cleaner path to building and deploying containerized Rails apps. Whether you're targeting Fly.io, Render, Railway, or your own VPS, you're ready to ship on day one.