I’m experiencing issues configuring the DNS using nmcli within the container. The problem arises when attempting to modify the ipv4.DNS parameter. I can successfully change the ipv4.addresses, gateway, and method settings without any problems. However, the error I encounter is as follows:
root@IB-1:~# nmcli con mod network0 ipv4.dns 8.8.8.8
Error: Failed to modify connection 'network0': ipv4.dns-data: unknown property
As I mentioned, this issue only occurs when running inside the container. When I perform the configuration in TorizonOS, there are no problems.
I’m sharing part of my Dockerfile and the output from tdx-info. If you need anything else, please let me know.
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
The issue you’re encountering with modifying the ipv4.DNS parameter using nmcli inside a Docker container is likely due to the limitations of running NetworkManager within a containerized environment. NetworkManager is designed to manage network configurations on the host system, and its functionality can be restricted or behave differently when executed inside a container.
Here are a few suggestions to address this issue:
NetworkManager in Containers: Ensure that NetworkManager is properly installed and configured within the container. However, note that running NetworkManager inside a container is not a common practice, as containers typically rely on the host’s network configuration.
Use Host Network: If possible, configure the DNS settings on the host system running TorizonCore instead of within the container. This way, the container can inherit the DNS settings from the host.
Alternative DNS Configuration: Consider using other methods to configure DNS within the container, such as modifying the /etc/resolv.conf file directly. This file is used by the system to determine DNS servers.
Docker Network Options: When starting the container, you can specify DNS servers using Docker’s --dns option. This will configure the container to use the specified DNS servers.
Check Permissions: Ensure that the container has the necessary permissions to modify network settings. You might need to run the container with elevated privileges or adjust its capabilities.
If these suggestions do not resolve the issue, it may be necessary to review the specific configuration of your Docker environment and the container’s setup.
Please, also check if these links can help you solve your problem:
First of all, you said you’re doing this in a container. Is it a requirement that you need to change the host network from within a container? is there a reason you can’t just do this outside of the container?
Second, this container you’re using how exactly did you start it? With what arguments and such. I imagine your container does not have access to the host network, nor does it have permission to change attributes of the host network.
You probably need to run your container with network set to host and probably with NET_ADMIN added to the capabilities of that container. If higher permissions are required maybe even running as privileged would be needed.
I’ve done some tests and the problem is related to a mismatch version between the NetworkManager installed in the OS and the one available on the container.
On the OS we are running the NetworkManager 1.36.2, while the container uses version 1.42. In this version, the communication with DBus has changed. The main reason you are facing this issue is that the property dns was replaced by dns-data, as you can see here.
If you need to configure the network from within the container, one alternative is fixing the version in your container to 1.36.2 too, since this version will remain stable in Torizon OS 6. To do this, you have to compile this version inside your Dockerfile, can you please try this and let us know the results?