Run nmcli from docker container

Tried to get WiFi list from Net Uno application using nmcli manager.
In debugging mode from VS Code program gives an exception. Looks like file “nmcli” not available to launch from docker container. Please refer to the piece of code below. Exception provided on nmcli.Start();
Is it any way to include nmcli into container or access it from the container ?
Thanks.

public List List()
{
using (var nmcli = new Process())
{
nmcli.StartInfo.FileName = “nmcli”;
nmcli.StartInfo.Arguments = “-t -f in-use,ssid,rate,signal,bars,security d wifi list”;
nmcli.StartInfo.UseShellExecute = false;
nmcli.StartInfo.RedirectStandardOutput = true;
nmcli.StartInfo.RedirectStandardError = true;
nmcli.Start();
var networks = new List();
while (!nmcli.StandardOutput.EndOfStream)
{
networks.Add(ParseNetworkString(nmcli.StandardOutput.ReadLine()));
}
nmcli.WaitForExit();
return networks;
}
}

Greetings @Serghey,

First of all have you actually installed nmcli inside your container? Just because the binary is on the host OS does not mean it’s available inside the container environment.

Next in order to use nmcli from inside a container other than installation, some particular runtime arguments are required. Please see the answer on this post for specifics: Change the apalis imx6 static IP address from inside a container

Best Regards,
Jeremias

I added the following buildcommands “RUN apt-get update && apt-get install network-manager”. Now process starts and nmcli.Start() returns “true”.
But no WiFi detected. Is it something else I need to add?

Did you also bindmount in /var/run/dbus into your container as suggested by the answer in that post?

Sorry, worked without of the antenna, probably signal was low.
Now it works properly. Thank you, so much for your help!

Ahh okay was just a simple issue then, good to hear.