Access to Host Networking Services

I am running Docker under Ubuntu on a Raspberry Pi.

The service that I am running in a container will receive a command that should toggle the host wireless networking on the Pi from client to AP mode.

I would normally do this with a shell script using the nmcli command line tool.

I can think of 2 options:

  1. try to map the nmcli commands/library/configuration inside the container so that it controls the host networking

  2. run a script on the host that is somehow called from the container

I tried option 1, but had issues with missing files. I have not tried option 2, since I’m not even sure it’s feasible.

I recognize that this is possibly an anti-pattern for Docker, but I’m trying to avoid having to install code on the host.