Getting DNS settings from DHCP and use it for my containers

Hi,

I want my docker to use the DNS Server IP which I am getting from my DHCP.
I can’t think of a better way of using “SOMEVARIABLE= nmcli dev list iface eth0 | grep "IP4.DNS\[1" |grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' and then use it in the configfile DOCKER_OPTS=”–dns $SOMEVARIABLE".
Does anybody have a better way to do it or a different idea.

Thanks in advance.