I am new to both docker and networking in general so bare with me. I have multiple docker (v 18.03.1 ce) containers running splunk on port 80 in a centos7 VM. I need to be able to directly access each container from outside the VM. I started each container with a different name and port mapping like this:
docker run --name container1 -p 8884:80 splunkimage
docker run --name container2 -p 8885:80 splunkimage
docker run --name container3 -p 8886:80 splunkimage
and I added a new rule in iptables:
iptables -A FORWARD -i docker0 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o docker0 -j ACCEPT
Here are the IPs:
docker0: 172.17.0.1
eth0: 192.168.1.5
VM IP: 172.29.0.9
The problem is I cannot access the splunk page when going to 172.29.0.9:8884 from my host machine. It says “webpage not available.” So then I tried 192.168.1.5:8884 and it says “no data received.” I clearly don’t know what I’m doing so can anyone help? (and yes the ports I used are actually open and available)