Skip to content

Commit

Permalink
Merge pull request containers#5 from nickgerace/main
Browse files Browse the repository at this point in the history
Create directory leading up to resolv.conf
  • Loading branch information
slp authored Feb 23, 2021
2 parents 367898a + 3ef17f3 commit 6247b3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/create.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Copyright 2021 Red Hat, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::fs::File;
use std::fs;
use std::io::Write;
use std::process::Command;

use super::utils::{mount_container, parse_mapped_ports, parse_mapped_volumes, umount_container};
use crate::{ArgMatches, KrunvmConfig, VmConfig, APP_NAME};

fn fix_resolv_conf(rootfs: &str, dns: &str) -> Result<(), std::io::Error> {
let resolvconf_dir = format!("{}/etc/", rootfs);
fs::create_dir_all(resolvconf_dir)?;
let resolvconf = format!("{}/etc/resolv.conf", rootfs);
let mut file = File::create(resolvconf)?;
let mut file = fs::File::create(resolvconf)?;
file.write_all(b"options use-vc\nnameserver ")?;
file.write_all(dns.as_bytes())?;
file.write_all(b"\n")?;
Expand Down

0 comments on commit 6247b3d

Please sign in to comment.