How to pass container ip as ENV to other container in docker-compose file : <p>this is my docker-compose file: </p>

<pre><code>version: '3.0'
services:
 app-web:
  restart: always
  build: ./web
  environment:
    PG_HOST: $(APP_DB_IP)
    PG_PORT: 5432
  ports:
   - "8081:8080"
  links: 
   - app-db

 app-db:
  build: ./db
  expose: 
   - "5432"

  volumes:
   - /var/lib/postgresql/data
</code></pre>

<p>I want to pass to app-web the ip of app-db (Postgresql in this case) as ENV var so it can connect to the DB smoothly... any idea on how to achieve it?</p>
