Setting Up Docker Swarm with VLANs: How Do I Connect Services?

September 17, 2025 2 answers
Asked by TechNerd99
I'm putting together a home lab with two mini PCs and a NAS, using the NAS as the Docker Swarm manager and the mini PCs as worker nodes. I know this might not be the most reliable setup since if the NAS dies, everything goes with it. My network has a main VLAN without tagging, and a separate tagged VLAN for IoT devices that connect via WiFi. Currently, I'm trying to move Frigate, which is running on another server, to my new Docker Swarm setup. I've read about macvlan and ipvlan, but I'm unsure how to connect services to specific VLANs. Is there a way to specify that a service needs to use a certain VLAN and allow it to communicate within that tag?

Answers

CloudJumper42
When it comes to Docker, VLANs aren't set per service or per container directly. Instead, you'll have to create a separate Docker network for each VLAN you want to use, and then attach your service to those networks. Check out the Docker documentation on macvlan for more details on how to set that up! Just a heads up, I've never used macvlan with swarm, it seems to go against what swarm is designed for.
Reply to this answer
DataDynamo73
Just keep in mind that VLANs work a bit differently than you might expect. They donโ€™t operate like VPNs for logical IP segmentation. If you're diving into this, it might be good to get familiar with untagged and tagged ports, as well as how managed switches handle this. These concepts can help you manage your setup better!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions