I have two network interfaces, eth0
and eth1
,
How could I bind all docker container to eth1
, and let all network traffic go ou
Here's something from the docker docs
https://docs.docker.com/v17.09/engine/userguide/networking/default_network/binding/
If you want to be more restrictive and only allow container services to be contacted through a specific external interface on the host machine, you have two choices. When you invoke docker run you can use either
-p IP:host_port:container_port
or-p IP::port
to specify the external interface for one particular binding. Or if you always want Docker port forwards to bind to one specific IP address, you can edit your system-wide Docker server settings and add the option--ip=IP_ADDRESS
. Remember to restart your Docker server after editing this setting.