@@ -146,6 +146,9 @@ pub struct CommonPodmanOptions {
146146 #[ clap( long = "name" , help = "Assign a name to the container" ) ]
147147 pub name : Option < String > ,
148148
149+ #[ clap( long = "network" , help = "Configure the network for the container" ) ]
150+ pub network : Option < String > ,
151+
149152 #[ clap(
150153 long = "label" ,
151154 help = "Add metadata to the container in key=value form"
@@ -165,12 +168,6 @@ pub struct CommonVmOpts {
165168 #[ clap( long = "karg" , help = "Additional kernel command line arguments" ) ]
166169 pub kernel_args : Vec < String > ,
167170
168- #[ clap(
169- long,
170- help = "Network configuration (none, user, bridge=name) [default: none]"
171- ) ]
172- pub net : Option < String > ,
173-
174171 #[ clap( long, help = "Enable console output to terminal for debugging" ) ]
175172 pub console : bool ,
176173
@@ -211,11 +208,6 @@ impl CommonVmOpts {
211208 pub fn vcpus ( & self ) -> u32 {
212209 self . vcpus . unwrap_or_else ( default_vcpus)
213210 }
214-
215- /// Get network config (default: "none")
216- pub fn net_string ( & self ) -> String {
217- self . net . clone ( ) . unwrap_or_else ( || "none" . to_string ( ) )
218- }
219211}
220212
221213/// Ephemeral VM options: container-style flags, host bind mounts, systemd injection.
@@ -380,19 +372,19 @@ fn prepare_run_command_with_temp(
380372 for label in opts. podman . label . iter ( ) {
381373 cmd. arg ( format ! ( "--label={label}" ) ) ;
382374 }
383- cmd. arg ( format ! ( "--net={}" , opts. common. net_string( ) . as_str( ) ) ) ;
384375
385- // Add container name if specified
376+ // Propagate all podman arguments
386377 if let Some ( ref name) = opts. podman . name {
387378 cmd. args ( [ "--name" , name] ) ;
388379 }
389-
390- // Add --rm flag based on user input (default: true)
380+ // Note that (unlike the libvirt flow) we rely on the default bridge network to avoid
381+ // port conflicts
382+ if let Some ( network) = opts. podman . network . as_deref ( ) {
383+ cmd. args ( [ "--network" , network] ) ;
384+ }
391385 if opts. podman . rm {
392386 cmd. arg ( "--rm" ) ;
393387 }
394-
395- // Add -t, -i, -d flags based on user input (mirror podman behavior)
396388 if opts. podman . tty {
397389 cmd. arg ( "-t" ) ;
398390 }
0 commit comments