How to reconfigure host network from container?

Hi there,

is there a workaround to allow a container to execute a command on the host?
Namely wpa_cli reconfigure && sudo service networking restart

I have an home automation app that, among other features, does wifi management (list and connect) via a web interface. It does it by writing /etc/wpa_supplicant/wpa_supplicant.conf and restarting the network interface9command above), when the device joins a different network.
It runs on a RPI and was recently dockerized.

I can write “wpa_supplicant.conf” in the host by using volumes, but I am struggling to tell the host to reconfigure wlan0 and restart the networking service.

I also would like to avoid moving wpa_supplicant from host to container, because I wish to keep wifi connectivity alive, while docker is down, so I can still access the device via SSH.

I acknowledge this is against docker container paradigm and not a common use case in the server side world, where Docker is focused.
However, docker offers some amazing features for hardware and embedded software development and I can see it becoming very popular in this space, too.

Hi, did you ever find a solution to this problem? Or even an alternative for connecting/list wifi networks from a docker container on a Pi?

Hi @fsamir
do you manage it?

i facing the same trouble about command wpa_cli reconfigure from docker container.

Every wpa_cli -i wlan0 [command] return error 254 and the command in upper case.

docker-compose exec core wpa_cli -i wlan0 scan
'SCAN' command timed out.
ERROR: 254

So i can edit the wpa_supplicant.conf but i cannot restart wlan0 interface without restart the rpi…