As welbo already stated: it is possible.
There is no need to introduce any vlans into your lan(!). No one stops you from using different vlans, though no one forces you to use one. I use a consumer grade DSL router which is not capable of managing vlans - except for the WAN port configuration.
When it comes to Docker macvlans, the only complicated part is to fit your macvlan iprange in your network’s subnet, in such a way that there is no overlap between the ips your networks dhcp server assigns or any manually assigned fixed ips.
Take the CIDR calculator of your chose and find yourself a free slice in your network.
By example:
My network is 192.168.200.0/24
My gateway is 192.168.200.1 (this is my dsl router)
My network’s DHCP server assigns ips in the range .100 to .200.
My fix ips are assigned from .1 to .63
The macvlan range can be 192.168.200.64/27, which will allow the range 192.168.200.64 - 192.168.200.95, which result in 32 ips that can be assigned for containers. You are free to choose whatever CIDR you want to pick, as long as it does not include a single occupied ip.
A macvlan network can be created externaly from the cli. This will allow plain docker containers (docker run, docker-compose) to attach to the network and either assign a fix ip of your choice or let the macvlan network’s dhcp server handle the assignment.
docker network create \
--driver macvlan \
-o parent=eth0 \
--subnet=192.168.200.0/24 \
--gateway=192.168.200.1 \
--ip-range=192.168.200.64/27 \
macvlan0
A container would use it like this: docker run --network="macvlan0" --ip="192.168.200.64" ...
Or you can leave the lifecylce to docker-compose and declare it in a docker-compose.yml:
networks:
macvlan0:
driver: macvlan
driver_opts:
parent: eth0
ipam:
config:
- subnet: 192.168.200.0/24
gateway: 192.168.200.1
ip_range: 192.168.200.64/27
To use it with a container you would declare it like this:
service:
myservice:
...
networks:
macvlan0:
ipv4_address: 192.168.200.64
Though, there can be only one macvlan network using the same gateway!
If the Docker host is running in a vm, of couse promiscous mode needs to be enabled for the vms network interface. If you use ESXi, the vswitch needs to allow promiscous mode.
I found two nice description of macvlan and ipvlan: https://sreeninet.wordpress.com/2016/05/29/macvlan-and-ipvlan/ and http://hicu.be/macvlan-vs-ipvlan