Docker Community Forums

Share and learn in the Docker community.

Access another network's ip device from inside container


I’m trying to reach a network printer from inside my app container while using the following setup

  • the host has 2 physical eth ports lan1 and lan2
  • lan1 is used to connect to upstream network
  • a docker container called nat-router is using lan2 to provide downstream network at 10.2.1.x the container setup is a combination of dnsmasq, pipework script and ip tables
  • the nat-router container ip is
  • the “printer” container ip is

my aim is to have the network printer available on the downstream network, for example at, however, I was unable to connect to it from inside the printer container.

this is the output of “ip r” on respective containers.

root@9f7cb70cf3d4:/# ip r
default via dev eth0 dev eth1 proto kernel scope link src dev eth0 proto kernel scope link src

root@0fb1fbfa5c46:/# ip r
default via dev eth0 dev eth0 proto kernel scope link src

Am I correct to think the 10.1.2 route should be added to the printing container for this to work ? What would be the best way to achieve that ?