Accessing container's IP in docker compose "command"

Hi,

I would like to use the IP address of a container in the “command” of docker compose. I tried to use the name of the image but it does not work. E.g.

version: '2'
services:

   cassandra:
    image: cassandra

    web:
      build: .
      links:
       - cassandra
      command: echo cassandra