Expose the database's ports

First, you need to expose Postgres's port on the container. Add a ports  section to the db  service in docker-compose.yml and map the port to your host:

    image: postgres:9.4
        - 5432:5432

Now restart the db container with: docker-compose up -d db 

Connect to the database

You'll be able to access the database:

  • address: 
  • port: 5432 
  • username: postgres 
  • password: not required 
  • database: db 

You'll find your application tables in Schemas/public/Tables .

Docker Toolbox users

If you're using Docker Toolbox, you can discover the IP address of the machine by running docker-machine ip

Did this answer your question?