Hello. I am just starting on my Docker journey so I am researching/reading whatever I can. The one thing I am unsure of is how I should handle the network side of my containers.
My home network has a few VLANs. The relevant ones are:
-
trust
- my main computer
- can access internet and other VLANs
-
serve
- all my server/service stuff like samba and what not
- limited internet access
- can access other devices in
serve
- cannot access other VLANs
-
dmz
- for anything that’ll be exposed to the internet
- limited internet access
- cannot access other VLANs
I intend to run multiple Docker containers on my server myMainServer
that is in the serve
VLAN. Most of the containers are internal services like Samba, NZBGet, etc.
If I understand right, if I leave all the Docker network stuff as default, then:
-
all my containers on
myMainServer
will secretly also be in theserve
VLAN since that is wheremyMainServer
is -
but none of the containers will actually get an IP on my router?
-
containers cannot talk to each other using
localhost
because, for containers,localhost
does not actually meanmyMainServer
's localhost -
container A
onmyMainServer
will be able to talk tocontainer B
onmyMainServer
usinghttp://[IP of myMainServer]:[host port of container B]
-
any devices on my
trust
VLAN will also be able to accesscontainer B
fromhttp://[IP of myMainServer]:[host port of container B]
Do I understand this right so far?
If so, if container A
talks to container B
then does the traffic stay on myMainServer
or does it go through my router? I assume no?
Second, I know I can use macvlan to create VLAN networks for Docker. But are those VLANs self-contained on the host or can the match my home network’s setup? Can I somehow get it to create a network for my dmz
VLAN? Meaning, I want container C
to be on the dmz
VLAN? If containers don’t actually get IPs from the router, then the container network will not really be on the dmz
VLAN, right?
Meaning, if I wanted to open ports in my router and forward them to my container, I’d actually be forwarding them to myMainServer
which is in the serve
VLAN.
I guess I am trying to see if it even makes sense to have a dmz
VLAN since the containers don’t get IPs on the router and the host handles all the traffic routing…