Changing to DHCP

You should try to use dbus interface to interact with the host OS, including networking (see in the docs about Container Runtime for some overview, and the dbus communication section in particular).

There are some other posts in the forum that have examples on how to do this (controlling the network interface from within the container), for example this post. Either Connman (the network manager in resinOS 1.x) and NetworkManager (the one used in resinOS 2.x) can be controlled over dbus.

In general, network configuration within the container is precarious and have a lot of edge cases. What sort of use case you have in mind for this, if you don’t mind my asking?