Does wifi-connect need to be mounted to host instead of port?

Hi @maggie0002,

WiFi Connect indeed needs host network mode as it operates on top of the physical WiFi interfaces. There is no way to run it outside of the host network.

You can still communicate with other containers running in bridge network mode though.

Let’s say you have an application called app running next to wifi-connect. You would like it to be able to communicate with the other containers, but those are running in bridge network mode.

There are two use-cases:

  1. app may have an open listening port that applications running in other containers want to connect to
  2. app may need to initiate connection towards applications running in other containers that have listening ports open

For scenario 1.: Since app is running in the host’s network namespace it needs to listen either on the 172.17.0.1 address (the br-xxxxxxxxxxxx interface) or on all addresses (0.0.0.0). Then you can reach app from the bridged containers through the 172.17.0.1 address, which happens to be their gateway.

For scenario 2.: The solution is to define ports in the docker-compose.yml file for the applications running in the bridge network containers and expose those ports to the host’s network namespace. This way app will be able to connect to those ports, since they are available both in the bridged namespace and the host’s namespace.

In both cases you may again consider using iptables to filter out access through eth0 or wlan0 to ports that you don’t want to be available from the external network/Internet. You may apply those from the container running in host network mode.

Thanks,
Zahari