version: "3"
services:
  # service configuration for our database
  database:

    # use the preferred version of the official Postgres image
    # see https://hub.docker.com/_/postgres/
    image: postgres:9.6.21
    environment:
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
    # persist the database between containers by storing it in a volume
    volumes:
      - docker-example-postgres:/var/lib/postgresql/data

  # service configuration for our dockerized Rails app
  app:

    # use the Dockerfile next to this file
    build: .
    entrypoint: /usr/local/bin/entrypoint.sh

    # rely on the RAILS_ENV value of the host machine
    # environment:
    #RAILS_ENV: $RAILS_ENV

    # makes the app container aware of the DB container
    depends_on:
      - database

    # expose the port we configured Unicorn to bind to
    ports:
      - "3000:3000"
    # map our application source code, in full, to the application root of our container
    volumes:
      - .:/var/www/consul
      - bundle:/usr/local/bundle
      - "$SSH_AUTH_SOCK:/tmp/agent.sock"
    environment:
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
      - SSH_AUTH_SOCK=/tmp/agent.sock
volumes:
  docker-example-postgres: {}
  bundle: {}

version: "3"
services:
  # service configuration for our database
  database:

    # use the preferred version of the official Postgres image
    # see https://hub.docker.com/_/postgres/
    image: postgres:9.6.21
    environment:
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
    # persist the database between containers by storing it in a volume
    volumes:
      - db_data:/var/lib/postgresql/data

  # service configuration for our dockerized Rails app
  app:

    # use the Dockerfile next to this file
    build: .
    entrypoint: /usr/local/bin/entrypoint.sh

    # rely on the RAILS_ENV value of the host machine
    # environment:
    #RAILS_ENV: $RAILS_ENV

    # makes the app container aware of the DB container
    depends_on:
      - database

    # expose the port we configured Unicorn to bind to
    ports:
      - "3000:3000"
    # map our application source code, in full, to the application root of our container
    volumes:
      - .:/var/www/consul
      - bundle:/usr/local/bundle
      - "$SSH_AUTH_SOCK:/tmp/agent.sock"
    environment:
      - POSTGRES_PASSWORD=$POSTGRES_PASSWORD
      - SSH_AUTH_SOCK=/tmp/agent.sock
volumes:
  db_data: {}
  bundle: {}

Use a better name for the database volume
Use a better name for the database volume

Having "example" in the name is an indicator that we're supposed to
change the name :).
