Create the directory that will contain your project:
mkdir my-new-app
cd my-new-appCreate 3 blank files:
touch Dockerfile
touch docker-compose.yml
touch entrypoint.shThen copy/paste the corresponding files below.
You may want to replace my_new_app by the name of your app in the file docker-compose.yml.
docker-compose builddocker-compose run web bash
# you're now running a bash terminal inside the container
gem install rails
rails new -d postgresql .
exit
# you're now out of the containerIn config/webpacker.yml replace the key development/dev_server/host with the value 0.0.0.0 (localhost is the default value and we don't want it).
Replace your default database.yml file with the one provided here.
echo "/docker" >> .gitignore
echo "/bundle" >> .gitignoredocker-compose updocker-compose run web bundle exec rails db:create