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.

Copy
version: '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

Owner of this card:

Avatar
vasan
Last edit:
over 5 years ago
by vasan
Keywords:
docker, compose
Posted by vasan to vasan's deck
This website uses short-lived cookies to improve usability.
Accept or learn more