Let qemu use /etc/resolv.conf of the target pod
QEMU already uses the network interfaces of the Pod. Also make the
/etc/resolv.conf of the container available for it.
This allows the QEMU process to resolve kubernetes DNS entries.
@@ -75,4 +75,9 @@ echo "$CMD" >> $LOG
# Don't close file descriptors bigger than 10000 to allow passing tap device fds
# Start the qemu process in the cgroups of the docker container
# to adher the resource limitations of the container.
-sudo -C 10000 bash -c -- "cgclassify -g ${CGROUPS}:system.slice/docker-$CONTAINER_ID.scope --sticky \$\$ && nsenter -t $CONTAINER_PID -n -p $CMD"
+sudo -C 10000 unshare --mount bash -s << END
+ nsenter -m -t $CONTAINER_PID cat /etc/resolv.conf > /etc/resolv.conf.\$\$
+ trap "{rm -rf /etc/resolv.conf.\$\$; }" EXIT
+ mount --bind /etc/resolv.conf.\$\$ /etc/resolv.conf
+ cgclassify -g ${CGROUPS}:system.slice/docker-$CONTAINER_ID.scope --sticky \$\$ && nsenter -t $CONTAINER_PID -n -p $CMD
+END
