How could I bind docker container to specific external interface

前端 未结 1 1914
一生所求
一生所求 2020-12-01 04:03

I have two network interfaces, eth0 and eth1,

How could I bind all docker container to eth1, and let all network traffic go ou

相关标签:
1条回答
  • 2020-12-01 05:06

    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.

    0 讨论(0)
提交回复
热议问题