diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index aa598bc7ca..16d7d1137a 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -1926,15 +1926,23 @@ pub fn setup_bundle(cid: &str, spec: &mut Spec) -> Result { let config_path = bundle_path.join("config.json"); let rootfs_path = bundle_path.join("rootfs"); - fs::create_dir_all(&rootfs_path)?; - baremount( - spec_root_path, - &rootfs_path, - "bind", - MsFlags::MS_BIND, - "", - &sl(), - )?; + let rootfs_exists = Path::new(&rootfs_path).exists(); + info!( + sl(), + "The rootfs_path is {:?} and exists: {}", rootfs_path, rootfs_exists + ); + + if !rootfs_exists { + fs::create_dir_all(&rootfs_path)?; + baremount( + spec_root_path, + &rootfs_path, + "bind", + MsFlags::MS_BIND, + "", + &sl(), + )?; + } let rootfs_path_name = rootfs_path .to_str()