Kubernetes service discovery inside chroot

10/21/2020

I'm building a chroot env in docker for a code sandbox. I need to resolve service names such as http://internal-service inside the chroot env. I've tried copying resolv over with RUN cp /etc/resolv.conf /jail/etc/resolv.conf but when I ssh into the container the resolv.conf is different inside chroot. I've tried copying /etc/hosts as well but hostnames still wont work. Regular networking works fine. Anyone know a fix?

EDIT: the trick is to copy /etc/resolv.conf at runtime, during build does not work

-- rawsh
chroot
docker
kubernetes

0 Answers