Docker MacVLAN Configuration Guide

In Docker networking, MacVLAN is a powerful tool that allows containers to connect directly with the host’s physical network. It is particularly useful in environments where you require your containers to be a part of the same network as your host, appearing as physical devices connected to the network switch.

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=enp6s18 lan
  • enp6s18 is the NIC’s name
  • 192.168.1.0/24 is definition of subnet
  • 192.168.1.1 is the gateway

To use this network, add this section to docker-compose.yaml

networks:
  lan:
    external: true



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Nextcloud
  • Unifi AP Get Started Guide
  • Unifi AP Get Started Guide
  • Cheatsheet to run MANUS
  • Establishing a telegraf metric system