How to get docker generated ip port from docker-compose

docker networking seems not working, docker supposed to know the address and port when specifying the container name, or what am I missing?

Would it be possible to get the generated ip port like:

docker-compose.yml

command: nsqd 
         --auth-http-address='host:docker inspect -f '{{(index 
         (index .NetworkSettings.Ports "80/tcp") 0).HostPort}}' some-image'

tried changing the --auth-http-address='0.0.0.0:80' for local address Im running it locally.

docker-compose.yml

services:
  service1:
    image: image_name
    command: nsqd --auth-http-address='authenticator'
  authenticator:
    image: some_image
    command: some server.py
    ports: - "80"
    container_name: authenticator

Had error message

Error: failed auth against authenticator address authenticator: missing port in address

Source: StackOverflow