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.
docker-compose builddocker-compose run web bash
# you're now running a bash terminal inside the container
gem install rails
rails new .
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).
echo "/docker" >> .gitignore
echo "/bundle" >> .gitignoredocker-compose up