title: Connect Docker container to specific network interface (e.g. eth1)?
body: <p>I have been <a href="https://stackoverflow.com/questions/32052975/how-could-i-bind-docker-container-to-specific-external-interface">here</a>, <a href="https://stackoverflow.com/questions/26289351/bind-physical-nics-to-containers-for-docker/50417994#50417994">here</a>, and all over the Docker documentation. I think I need this explained in much simpler terms.</p>
  
  <p>My Docker container needs to be able to do two things: </p>
  
  <ol>
  <li>Connect to a device (a camera) on the host machine</li>
  <li>Connect to a specific network interface (eth1) to send data</li>
  </ol>
  
  <p>To satisfy them both, I have chosen to run the container as a command given by a superservice. 
  My <code>docker-compose.yml</code> looks like this:</p>
  
  <pre><code>version: "3"
  services:
    superservice:
      image: docker
      command: docker run -it --device=/dev/vchiq my/image-to-run:latest
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      deploy:
        replicas: 1
        mode: replicated
      stdin_open: true
      tty: true
  </code></pre>
  
  <p>This way I can still <code>docker stack deploy</code> my service onto a swarm (otherwise, specifying <code>--device</code> doesn't work with swarm mode). When I initiate the swarm I do so with docker <code>swarm init --advertise-addr my:wlan:ip:addr --data-path-addr eth1</code>. 
  I thought this would route the packets that I'm sending from my container through <code>eth1</code> to the destination.</p>
  
  <p>But, when I <code>tcpdump -i eth1</code> nothing goes through it. It's all still going through <code>wlan0</code>. </p>
  
  <p>Why this is happening, and how to fix it?</p>