mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-30 14:25:43 +00:00
Merge pull request #366 from nitkon/dns_initrd
initrd_builder: Create empty resolv.conf in rootfs
This commit is contained in:
commit
3e4b381248
@ -391,9 +391,6 @@ create_rootfs_image() {
|
||||
info "Creating empty machine-id to allow systemd to bind-mount it"
|
||||
touch "${mount_dir}/etc/machine-id"
|
||||
|
||||
info "Creating empty resolv.conf to allow kata-agent to bind-mount it"
|
||||
touch "${mount_dir}/etc/resolv.conf"
|
||||
|
||||
info "Unmounting root partition"
|
||||
umount "${mount_dir}"
|
||||
OK "Root partition unmounted"
|
||||
|
@ -510,6 +510,15 @@ EOT
|
||||
[ -x "${init}" ] || [ -L "${init}" ] || die "/sbin/init is not installed in ${ROOTFS_DIR}"
|
||||
OK "init is installed"
|
||||
|
||||
# Create an empty /etc/resolv.conf, to allow agent to bind mount container resolv.conf to Kata VM
|
||||
dns_file="${ROOTFS_DIR}/etc/resolv.conf"
|
||||
if [ -L "$dns_file" ]; then
|
||||
# if /etc/resolv.conf is a link, it cannot be used for bind mount
|
||||
rm -f "$dns_file"
|
||||
fi
|
||||
info "Create /etc/resolv.conf file in rootfs if not exist"
|
||||
touch "$dns_file"
|
||||
|
||||
info "Creating summary file"
|
||||
create_summary_file "${ROOTFS_DIR}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user