Docker MAC vLAN

I have been testing out the new app support in the latest beta ElectricEel-24.10-BETA.1

I am impressed with how well it’s working. I have treated the test system with disdain, and every time I got the system booted back up all apps spun up and were healthy.

I’m going to be playing around with some MAC vLAN config through the terminal but it would be great if you could assign a NIC to docker as a trunk port and create MAC vLANs. That was you could assign different IPs to each docker container.

Keep up the good work with the new apps implementation.

4 Likes

Did you get docker macvlans to work on 24.10?

Im trying to segregate web facing containers into a dmz vlan while keeping my Truenas in lan. I can easily create a VM in the dmz, but i have trouble getting containers to do so using macvlan or ipvlan… can connect to them on local host but can’t seem to get them to route properly to WAN

Not sure if it’s how either of you are looking to implement it but you can install portainer and set up MacVlans through it, I did this myself over the last week or so, I dont actually use the macvlan tbh but it was more - lets see if I can* set this up so if i ever need it down the line I have it.

Have a look here on how I achieved that the Docker container is residing on a subnet 192.168.60.0/24 which is a tagged VLAN coming in on one of the interfaces (enp4s0) on my TrueNAS Scale baremetal installation

services:
  qbittorrent:
    container_name: qbittorrent
    image: qbittorrentofficial/qbittorrent-nox:latest
    hostname: qbittorrent
    environment:
      - QBT_LEGAL_NOTICE=confirm
      - QBT_VERSION=latest
      - PUID=850
      - PGID=1002
      - TZ=Europe/Paris
      - TORRENTING_PORT=6881
      - QBT_WEBUI_PORT=8090
    volumes:
      - /mnt/Tank/Docker/qbittorrent:/config
      - /mnt/Tank/Torrents:/downloads
    ports:
      - 8090:8090/tcp
      - 6881:6881/tcp
      - 6881:6881/udp
    restart: unless-stopped
    stop_grace_period: 30m
    tmpfs:
      - /tmp
    tty: true
    networks:
      vlan60_macvlan:
        ipv4_address: 192.168.60.30  # <-- Choose an unused IP from your subnet
    dns:
      - 192.168.60.24  # <-- DNS
      

networks:
  vlan60_macvlan:
    driver: macvlan
    driver_opts:
      parent: enp4s0.60                   # <-- match your parent interface name
    ipam:
      config:
        - subnet: 192.168.60.0/24     # <-- match your LAN subnet
          gateway: 192.168.60.2       # <-- match your router gateway