Ubuntu focal image - Network configuration directory

Dear team,

I am using Ubuntu ubuntu:focal-20220801 container. I need to add “search xyz.com” to my /etc/resolv.conf.
However, this change doesn’t persist if the docker container is killed and restarted. (dhclient probably overwrites it)

Is there anyway I can make it persistent ?

This is ubuntu 20.04.5 LTS. I can’t find netplan configuration files or /etc/netplan or /etc/network/interface configuration files.


Containers will not have their own netplan configuration. Containers are just isolated processes and the resolv.conf is generated for the containers and mounted into the container.

docker container inspect containername --format '{{ .ResolvConfPath }}'

If you get the help of docker run, you will get the parameters with which you can control the network including the DNS search parameter:

docker run --help
docker run --help | grep dns
      --dns list                       Set custom DNS servers
      --dns-option list                Set DNS options
      --dns-search list                Set custom DNS search domains

wow, thank you @rimelek I did not think of docker run - dns-search. That would work perfect for me. I’ll try it.