When I try to run ‘nmcli’ in the Docker shell, the command is not found.
What is best practice to get ‘nmcli’ running within the Docker container?
Do I need to apt-get the NetworkManager in the project-file “Dockerfile.debug”?
For Docker “cap_add”, is it CAP_NET_ADMIN oder NET_ADMIN (like in the link above)?
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello Lars,
To run the ‘nmcli’ command within a Docker container on Torizon OS, you’ll need to ensure that the NetworkManager package is installed inside the container. Here’s how you can achieve this:
Modify the Dockerfile: Add a line to install NetworkManager in your Dockerfile. If you’re using a Debian-based image, you can include the following:
RUN apt-get update && apt-get install -y network-manager
This will make ‘nmcli’ available inside the container.
Update Docker Compose File: Ensure your Docker Compose file correctly mounts the necessary volumes and adds the required capabilities:
Note that the capability should be specified as ‘NET_ADMIN’, which is the correct syntax.
Rebuild and Restart the Container: After modifying the Dockerfile, rebuild your Docker image and restart the container to apply the changes.
By following these steps, you should be able to run ‘nmcli’ within your Docker container. This setup allows the container to interact with the host’s NetworkManager service, provided the necessary permissions and volumes are correctly configured.
I hope this helps! If you have any more questions, feel free to ask.
Best regards,
Toradex AI Assistant.
Please, also check if these links can help you solve your problem: