Docker Community Forums

Share and learn in the Docker community.

Docker does not follow symlink /etc/hosts -> /var/etc/hosts

Hi In container rootfs /etc/hosts is symlink to /var/etc/hosts . However docker mounts /etc/hosts as file. Is there way to make docker either follow the symlink or disable mounting /etc/hosts .

docker run --rm -it --network=host debian:buildah bash
root@q-ubm16-mdhillo:/# ls -l /etc/hosts
-rw-r–r-- 1 root root 283 Jul 10 17:45 /etc/hosts

Expected:
root@q-ubm16-mdhillo:/# ls -l /etc/hosts
lrwxrwxrwx 1 root root 14 Jul 10 17:36 /etc/hosts -> /var/etc/hosts

Thanks
Mrinal