I'm quite new to Docker and recently set up a barebones Arch Linux box to experiment with. My initial containers are working well with standard networking, but I'm facing issues when trying to use macvlan and ipvlan network types. My goal is to have two containers with IP addresses on the local network, but despite following multiple tutorials, including advice from Docker and Arch forums, I can't get the containers to ping the gateway. The only notable difference is that I'm using Arch while most examples are based on Ubuntu. Is there something specific about Arch that could be causing this issue? Here are some details from my host setup:
- Host IP: 10.2.115.2/24
- Gateway: 10.2.115.1
I created the macvlan using the command: `docker network create -d macvlan --subnet 10.2.115.0/24 --gateway 10.2.115.1 -o parent=eth0 macvlan0`. The container is set with an IP of 10.2.115.3, but it shows an incomplete ARP for the gateway. I have disabled the firewall in Arch and adjusted the proxy arp setting. I'm not sure where to go next.
3 Answers
It looks like you might need to create a MACVLAN bridge on your host. On some systems, including Debian, this is required. You can set this up in your network configuration file. Here's a simple guide:
1. Add a MACVLAN bridge as a child of your primary interface in your network settings.
2. Then, recreate your Docker MACVLAN with the appropriate settings. This bridge allows Docker containers to communicate properly with the gateway. Let me know how it goes!
Honestly, macvlan and ipvlan are options that aren't commonly needed. They can be quite complex and there might be simpler alternatives for your scenario. Have you considered a different network mode that allows individual container IP addresses but simplifies the overall setup?
Do you have any recommendations for easier alternatives to achieve container-based IPs?
You seem to have a pretty specific use case. If your client needs to connect directly by IP and you're relying on a central database setup, it helps to clarify the network configurations. Make sure that your Docker containers are on the same network as the database. If you need further assistance, feel free to share more details!
Thanks for the tip! I'll try setting up the bridge as you suggested.