How to add DNS search or nameserver for internal networks to resolv.conf

Is there any way to include domain to search or a particular nameserver to the resolv.conf file on the Travis CI virtual environment?
I tried to append it directly to the /etc/resolv.conf file, but I got a permission denied message.

/home/travis/.travis/functions: line 104: /etc/resolv.conf: Permission denied

This is a general Linux question rather than Travis-specific, so asking at a Linux forum will probably be more useful.

For example, the below topic provides a few ways to add a nameserver to resolv.conf. It’s however very unclear what exactly you are trying to achieve so can’t say if that’s what you need.

I want to be able to use the short hostnames host1 for an application and that travis virtual environment be able to resolve to the fqdm host1.domain1.internal.com since my company has some internal domains for it.
I use to manage this by adding the line search domain1.internal.com domain2.internal.com to the /etc/resolv.conf, but it seems I get the “permission denied error” while trying to do that on the after_script section.
Is there any way to get the desired configuration for the hostname to be resolved automatically searching with an specified domain?

I don’t know how you’re trying to modify /etc/resolv.conf, but you’d need the root privilege to do so; e.g.,

sed -e 'YOUR SED PROGRAM' /etc/resolv.conf > resolv.conf.new
sudo mv resolv.conf.new /etc/resolv.conf

As @native-api pointed out, this not a Travis question, per se.

Imprint