Skip to content

rails/docked

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
December 15, 2022 08:45
February 5, 2023 20:15
December 13, 2022 19:50

Docked Rails CLI

Setting up Rails for the first time with all the dependencies necessary can be daunting for beginners. Docked Rails CLI uses a Docker image to make it much easier, requiring only Docker to be installed.

Install Docker (and WSL on Windows). Then copy'n'paste into your terminal:

docker volume create ruby-bundle-cache
alias docked='docker run --rm -it -v ${PWD}:/rails -v ruby-bundle-cache:/bundle -p 3000:3000 ghcr.io/rails/cli'

Then create your Rails app:

docked rails new weblog
cd weblog
docked rails generate scaffold post title:string body:text
docked rails db:migrate
docked rails server

That's it! Your Rails app is running on http://localhost:3000/posts.

Adding more aliases

If you'd like to have the standard Ruby and Rails bins available without writing docked before each command, you can add them as aliases:

alias rails='docked rails'
alias rails-dev='docked bin/dev'
alias bundle='docked bundle'
alias yarn='docked yarn'
alias rake='docked rake'
alias gem='docked gem'

About

Running Rails from Docker for easy start to development

Resources

License

Stars

Watchers

Forks

Releases

No releases published