Hello,
I want to change DNS for containers. I changed the daemon.json
file as follows:
{
"dns": ["IP1", "IP2"]
}
Now, if a container is run, will it use the IP addresses defined in the above file?
I tried to change DNS as below via Dockerfile:
FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package*.json ./
RUN chmod -R og+rwx /etc/
RUN echo "nameserver IP" > /etc/resolv.conf
RUN npm install --force
COPY . .
CMD npm start
But I got the following error messages:
=> ERROR [ewallet 5/8] RUN chmod -R og+rwx /etc/ 1.1s
------
> [Test 5/8] RUN chmod -R og+rwx /etc/:
0.687 chmod: changing permissions of '/etc/resolv.conf': Read-only file system
0.814 chmod: changing permissions of '/etc/hosts': Read-only file system
Any idea to solve this error?
Thank you.