Steps
- docker-compose run --no-deps web rails new . --force --database=postgresql
- sudo chown -R $USER:$USER . (For Linux user)
- docker-compose build
- Update database.yml
default: &default
adapter: postgresql
encoding: unicode
host: db
username: postgres
password: password
pool: 5
development:
<<: *default
database: myapp_development
test:
<<: *default
database: myapp_test
- docker-compose up
- docker-compose run web rake db:create
- http://localhost:3000
source: https://docs.docker.com/compose/rails/
Demo: https://www.youtube.com/watch?v=VQ4zIpSTTgM&t=3s