Dokcer – Changing permissions of /etc/hosts in docker file gives error

  docker, docker-build

I am using Docker version 20.10.7 and building below mentioned docker file:

FROM maven:3.6.3-adoptopenjdk-11

COPY ./ ./

RUN addgroup --gid 900--system gtest
RUN adduser --uid 9000--system --disabled-password --gecos "" --shell /bin/sh --ingroup gtest utest;

RUN chmod 777 /etc/hosts 

USER 9000


Docker builds throws:

#13 0.368 chmod: changing permissions of '/etc/hosts': Read-only file system

In i need to update /etc/hosts as user utest(9000). Is it possible to change permissions of /etc/hosts (make it writeable) in docker file or is it forbidden in docker ?

Source: Docker Questions