dockerのインストールが終わっている前提
# コンテナを作る。
$ docker pull ruby:2.4.1
$ docker run -it -v /PATH/TO/LOCAL/RAILS_DIR:/usr/src/rails_app -w /usr/src/rails_app -p 3000:3000 ruby:2.4.1 /bin/bash
# 以下docker内部での作業
# 最近のrailsはnode必要だから、node入れる
apt-get update \
&& apt-get install -y --no-install-recommends \
nodejs npm \
&& rm -rf /var/lib/apt/lists/*
npm install n -g
n stable
# 新規にrailsアプリを作る場合
gem install rails
gem new .
rails s -b 0.0.0.0
# すでにrailsアプリが作成済みの場合
bundle install
rails s -b 0.0.0.0