Docker Community Forums

Share and learn in the Docker community.

Giving a container access to an IP on the host machine through IPTables

Hello,

I am currently trying to allow one of my containers to access an IP on the host machine. I want to avoid using the --network host option in the build process as I don’t want all the containers sharing the same network but they all do need to get to the same one IP address on the host.

Essentially I just need containers A, B, C and D to curl an IP such as 192.168.1.1 and get the response but despite spending a few hours looking I can’t find an example this specific, most dealt with port forwarding.

Regards