Hi, I am trying to add a host in the etc/hosts file in my container via:
RUN echo “ip server.name” >> /etc/hosts
I am using ubuntu:jammy as base image.
I get the following error:
/bin/sh: 1: cannot create /etc/hosts: Read-only file system
Share and learn in the Docker community.
Hi, I am trying to add a host in the etc/hosts file in my container via:
RUN echo “ip server.name” >> /etc/hosts
I am using ubuntu:jammy as base image.
I get the following error:
/bin/sh: 1: cannot create /etc/hosts: Read-only file system
Hi,
Thats intended, since docker maintains this file it also prevents other from editing it.
What you should look into instead: