How Can I Assign IP Addresses to Docker Containers Using an External DHCP Server?

0
0
Asked By TechieTiger123 On

I'm running Docker inside a Debian VM on a bare metal server managed by Proxmox, and I want my Docker containers to receive IP addresses from my network's router, which is also acting as the DHCP server. I've read that using the macvlan driver in Docker is necessary for this, but when I create a container under this network, it only gets an internal IP address instead. Some articles suggest plugins or that this simply isn't a supported feature in Docker. I'm looking for any guidance on whether this is even possible, and if so, how to approach it.

4 Answers

Answered By CloudGuru22 On

If you're trying to expose multiple services, using a reverse proxy is the way to go. You can manage all your services through one public IP by directing traffic based on URLs. It's actually more secure this way, preventing your backend applications from being directly exposed.

Answered By NetworkNinja99 On

You really don't need to assign IP addresses manually to your containers. By default, Docker manages IPs dynamically within its own network. You can access services running in containers through the host IP address. If you have a special case where a container needs its own public IP (like a DNS server), then MACVLAN can work for that, but be cautious about the overall necessity.

Answered By DockerDude89 On

It's surprising to see people forcing IP assignments when Docker provides automatic management. Instead of complicating things, consider using a reverse proxy alongside your own DNS to handle multiple services efficiently without needing separate IPs for each.

Answered By CleverCoder42 On

You might want to reconsider this approach. It's common for beginners to think of containers like virtual machines, but they're not quite the same. Typically, individual containers don't need their own public IP addresses. You can expose necessary ports from the Docker host instead. Alternatively, look into setting up a reverse proxy for better management. Using MACVLAN to assign individual IPs can complicate things unnecessarily, so it's generally not recommended.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.