I'm a beginner trying to give my Docker container its own IP address on my home network. I believe this can be accomplished using ipvlan, but I'm struggling to find clear instructions on how to set it up in my docker-compose.yml file. Is there any official documentation to help out, or am I misunderstanding something?
1 Answer
You're on the right track looking into ipvlan! The official Docker documentation has some helpful resources that outline the network driver options for ipvlan. You can check them out here: [ipvlan documentation](https://docs.docker.com/engine/network/drivers/ipvlan/). Also, the format for setting network driver options in your compose file is detailed here: [Compose file networks attributes](https://docs.docker.com/reference/compose-file/networks/#attributes). If you're open to alternatives, consider macvlan, as it functions similarly. Depending on what you're aiming for with assigning IP addresses, other setups like host mode networking or reverse proxies might suit your needs too.
Thanks so much for the links! I actually want to assign unique IPs to each container because I'm planning to set up a DNS server for them so that they each have their own domains. I looked into reverse proxies, but I’m trying to avoid routing every request through one.
I tried adding those ipvlan fields to my compose file, but my container can still be reached through the host's IP. Now I'm really confused about how ipvlan works. Why is it separate from macvlan? And how does a router connect an IP to a device without a MAC address? The docs mention 'network'—does that refer to the network driver? I'm just trying to understand how giving a container an IP addresses an entire network setup!