File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -431,11 +431,6 @@ impl LinuxJail {
431431 . with_context ( || format ! ( "Failed to create directory: {}" , netns_namespace_dir) ) ?;
432432 debug ! ( "Created directory: {}" , netns_namespace_dir) ;
433433
434- // Create namespace config resource
435- self . namespace_config = Some ( ManagedResource :: < NamespaceConfig > :: create (
436- & self . config . jail_id ,
437- ) ?) ;
438-
439434 // Write custom resolv.conf that will be bind-mounted into the namespace
440435 // Point directly to the host's veth IP where our DNS server listens
441436 let resolv_conf_path = format ! ( "{}/resolv.conf" , netns_namespace_dir) ;
@@ -459,6 +454,12 @@ nameserver {}\n",
459454 anyhow:: bail!( "Failed to create resolv.conf at {}" , resolv_conf_path) ;
460455 }
461456
457+ // Create namespace config resource for cleanup tracking
458+ // IMPORTANT: Create this AFTER writing resolv.conf to ensure the file exists
459+ self . namespace_config = Some ( ManagedResource :: < NamespaceConfig > :: create (
460+ & self . config . jail_id ,
461+ ) ?) ;
462+
462463 Ok ( ( ) )
463464 }
464465
You can’t perform that action at this time.
0 commit comments