I have multiple interfaces from my main server, e.g. (eno1
, eno2
, eno3
, etc.) and multiple interfaces from an additional ethernet card, e.g. (enp7s0f0
, enp7s0f1
, etc.). I want to set up all my docker-compose.yaml
files to use the different interfaces, e.g. I want to have service_1
use eno2
, service_2
to use eno3
, and service_3
use enp7s0f0
. I want traffic in on specified ports and all traffic out to use the different interfaces.
Below is a sample docker-compsoe.yaml
:
version: '3.7'
services:
service_1:
build: .
networks:
- eno2
ports:
- 7878:7878
networks:
eno2:
driver: macvlan
driver_opts:
parent: eno2
ipam:
driver: default
I'm not sure the proper format for specifying a different interface I've looked over the Docker Compose Networking page, but can't seem to find what I'm looking for. I need a solution that is fully contained in a docker-compose.yaml
file.
Edit: The macvlan
appears to be what I'm trying to configure. Following post from here, I've edited Docker Compose file. However, I'm still not able to spin up multiple images that send outbound traffic through different interfaces, and activity goes through the default interface (eno1
).