How do I change the resolv.conf file?

Hello,
I am using the node:latest image and I want to change an IP address in the /etc/resolv.conf file. I tried both of the following commands in the Dockerfile, but it didn’t work:

ADD resolv.conf /etc/

And:

COPY resolv.conf /etc/

What other method is there?

Thank you.

Hello,
I also tried other methods but did not get any results:

# /etc/docker/daemon.json
{
    "dns": ["4.2.2.4", "8.8.8.8"]
}

And:

# dockerd --dns 8.8.8.8

Does Docker use the host’s DNS settings by default?