Static IP for docker containers

Hi Folks…Im using my local images to run my containers. im doing so using docker-compose.yml file. im trying to specify my containers static IP. the IP im mentioning here is bridge IPs which is automatically created. im facing some error, as i see my yml file is valid giving more information below.

docker-compose.yml:
version: “2”
networks:
frontend:
ipam:
config:
- subnet: 172.17.0.0/24
slave:
image: slave:latest
hostname: host2.local
extra_hosts:

  • “host1.local:172.17.0.2”
  • “host2.local:172.17.0.3”
  • “host3.local:172.17.0.4”
    networks:
    frontend:
    ipv4_address: 172.17.0.2

master:
image: master:latest
hostname: host1.local
extra_hosts:

  • “host1.local:172.17.0.2”
  • “host2.local:172.17.0.3”
  • “host3.local:172.17.0.4”
    networks:
    frontend:
    ipv4_address: 172.17.0.4
    slave2:
    image: slave2:latest
    hostname: host3.local
    extra_hosts:
  • “host1.local:172.17.0.2”
  • “host2.local:172.17.0.3”
  • “host3.local:172.17.0.4”
    networks:
    frontend:
    ipv4_address: 172.7.0.3

Error:
ERROR: The Compose file ‘./docker-compose.yml’ is invalid because:
Unsupported config option for networks: ‘frontend’
Unsupported config option for master: ‘networks’
Unsupported config option for slave: ‘networks’
Unsupported config option for slave2: ‘networks’

docker-compose version:
docker-compose version 1.23.2, build 1110ad01
docker-py version: 3.6.0
CPython version: 3.6.7
OpenSSL version: OpenSSL 1.1.0f 25 May 2017

Thank you.