Getting "FATAL: role "root" does not exist" when trying to do "docker up"
<p>I'm starting to work with an existing Rails project that uses Docker. I've used Rails for a long time but never Docker.</p>

<p>After I do a <code>docker build .</code> I try to do a <code>docker-compose up</code>, but I get:</p>

<blockquote>
  <p>FATAL:  role "root" does not exist
  /usr/local/bundle/gems/activerecord-4.2.5.2/lib/active_record/connection_adapters/postgresql_adapter.rb:661:in `rescue in connect': FATAL:  role "root" does not exist (ActiveRecord::NoDatabaseError)</p>
</blockquote>

<p>It seems to me that the Docker machine is probably trying to connect to the database as the <code>root</code> user, but there's no role called <code>root</code>, so the connection is rightly failing.</p>

<p>The thing I don't know is why Docker is apparently trying to connect to the database as <code>root</code> and how to get it to use the right user.</p>

<p>Here's my <code>database.yml</code>:</p>

<pre><code>development:
  database: my_app_development
  adapter: postgresql
  encoding: unicode
  pool: 5
</code></pre>

<p>Any help is appreciated.</p>

<p>Edit: here's my <code>docker-compose.yml</code>:</p>

<pre><code>web:
  build: .
  volumes:
    - .:/my_app
  ports:
    - "3000:3000"
  links:
    - postgres
    - redis
    - mailcatcher
  env_file:
    - 'config/application.yml'
postgres:
  image: postgres:9.4
  ports:
    - "5432"
  env_file:
    - 'config/database.yml'
redis:
  image: redis:3.0.6
mailcatcher:
  image: schickling/mailcatcher
  ports:
    - "1080:1080"
</code></pre>