Create a MAC VLAN network
Description
The command below is an example of creating a layer 2 macvlan network in docker. In the example below, the network I am using is 10.128.140.0/24 on interface ens160. You will have to replace the subnet and interface according to your install.
Conifguration
docker network create -d macvlan --subnet=10.128.140.0/24 --gateway 10.128.140.1 -o parent=ens160 L2-Connect
and this is how you add a VLAN network
docker network create -d macvlan --subnet=172.16.8.0/22 --gateway 172.16.8.1 -o parent=ens192.40 Data-40-L2-Connect
After creation of the network you can take a look to make sure it exists
root@container:~# docker network ls
NETWORK ID NAME DRIVER SCOPE
01734d37ed78 L2-Connect macvlan local
310563fabcd7 bridge bridge local
4bc024cbd7cc host host local
d2879a267450 none null local