Docker Community Forums

Share and learn in the Docker community.

How to reconfigure host network from container?


(Fsamir) #1

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.