How to Set Up IPvlan in Docker Compose for Separate IPs?
Asked by
gusset fitted!
I'm a beginner and I'm trying to give my Docker container its own IP address on my home network using ipvlan. However, I'm struggling to find proper instructions or documentation on how to set this up in my docker-compose.yml file. Am I on the right track, or is there a better way to approach this?
Answers
You're on the right path! The Docker documentation for ipvlan is a good start, but it's scattered around. You can check out the ipvlan driver options [here](https://docs.docker.com/engine/network/drivers/ipvlan/) and see how to format it in your compose file [here](https://docs.docker.com/reference/compose-file/networks/#attributes). If youโre looking for alternatives, macvlan is quite similar to ipvlan, so see if that might work better for you. Depending on your situation, also consider host mode networking or reverse proxies for managing your IPs better.
Reply to this answer
I tried adding those options to my compose file too, but I noticed the container was still reachable through the host's IP. I donโt quite get the difference between ipvlan and macvlan. If ipvlan doesn't utilize a mac address in the usual way, how does it link an IP to a device on a router? Also, when the docs mention "network," are they talking about the network driver? If Iโm just assigning an IP, how does that set up an entire network? Sorry for bombarding you with questions, but I'm feeling a little confused!
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions