Posted over 5 years ago. Visible to the public.
Docker Compose Network
This example shows that how the static ip can be assigned to container and how to add another container network to a container. This can be done only for version 2 compose.
Copyversion: '2' services: app: image: busybox command: ping www.google.com networks: app_net: ipv4_address: 10.0.0.10 webapp: image: busybox command: ping www.yahoo.com network_mode: service:app networks: app_net: driver: bridge ipam: driver: default config: - subnet: 10.0.0.0/24 gateway: 10.0.0.1