Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

357
Visualizações
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.

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.

/etc/systemd/system/docker.service.d/docker.conf

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -b=wlan1 --ip=10.0.0.151 -H fd://

docker-compose.yml

version: "2"

networks:
  open_network_1:
    driver: bridge
    driver_opts:
      com.docker.network.host_binding_ipv4: "10.0.0.151"

services:
  open_wifi_phantomjs:
    image: https://github.com/ollihoo/phantomjs-docker-rpi
    networks:
      - open_network_1
    ports:
      - 10.0.0.151:80:80
      - 10.0.0.151:443:443

I've also fiddled with ip routing, and iptables

ip route del 172.19.0.0/16
ip route add 172.19.0.0/16 dev wlan1 proto kernel scope link src 172.19.0.1

iptables -t nat -A POSTROUTING -s 172.19.0.0/16 -j SNAT --to-source 10.0.0.151

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

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

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda