Docker force container to specific physical interface

I’ve been searching around the internet for the past week or so to find a solution to this, but so far I have come up empty handed.

There are three network interfaces available to my host, and I need to execute a phantomjs script on the wlan1 interface.

  • Can FreeBSD be run inside Docker?
  • Register an instance to an AWS ECS cluster
  • Docker Compose circular container linking
  • docker sonarqube checkdependency plugin
  • What is the special gitlab-ci-token user?
  • How to mount external volume for mongoDB using docker-compose and docker-machine
  • My idea was to utilize Docker, but am running into issues locking a container to a specific interface.

    Here’s what I’ve tried, all either redirects to another interface, or has no network access. The only method that allows explicit access to the interface I need is by turning off all other interfaces.


    ExecStart=/usr/bin/docker daemon -b=wlan1 --ip= -H fd://


    version: "2"
        driver: bridge
          - open_network_1

    I’ve also fiddled with ip routing, and iptables

    ip route del
    ip route add dev wlan1 proto kernel scope link src
    iptables -t nat -A POSTROUTING -s -j SNAT --to-source

    172.19 would be the subnet created by the docker-compose network, would be the ip assigned to the wlan1 interface.

    Any insight would be appreciated, and I’m sure will help those with similar goals.

  • Kubernetes run on AWS
  • docker containers communication on dev machine
  • docker nginx load balancing not working with Azure
  • How to write variable in docker-compose, running multiple containers which uses the same image but their ports are different
  • Installing maven in a docker build overrides JAVA 8 with JAVA 7(!)
  • How to build a sidecar container for passing files from a machine outside of the Kubernetes cluster?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.