You might want to update your component and yml database as follows. With expected user and db's password database.yml. Alternatively, you can make this an environment variable. But first try the default for the dock dg postgres image as follows:
database.yml
development:
database: my_app_development
adapter: postgresql
encoding: unicode
pool: 5
username: postgres
password:
host: postgres(db name in docker-compose.yml)
docker-compose.yml
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/my_app
ports:
- "3000:3000"
links:
- postgres
- redis
- mailcatcher
postgres:
image: postgres:9.4
ports:
- "5432"
redis:
image: redis:3.0.6
mailcatcher:
image: schickling/mailcatcher
ports:
- "1080:1080"
I do not think you want to save
env_file:
- 'config/database.yml'
and
env_file:
- 'config/application.yml'
Then create the databases using docker-compose run web rake db:create
, , Dockerfile. docker build -t app-name ., docker-compose up.