@@ -8,7 +8,7 @@ use std::{
88
99#[ cfg( feature = "device-requests" ) ]
1010use bollard:: models:: DeviceRequest ;
11- use bollard:: models:: ResourcesUlimits ;
11+ use bollard:: models:: { HostConfig , ResourcesUlimits } ;
1212
1313use crate :: {
1414 core:: {
@@ -49,6 +49,7 @@ pub struct ContainerRequest<I: Image> {
4949 pub ( crate ) startup_timeout : Option < Duration > ,
5050 pub ( crate ) working_dir : Option < String > ,
5151 pub ( crate ) log_consumers : Vec < Box < dyn LogConsumer + ' static > > ,
52+ pub ( crate ) host_config_modifier : Option < Box < dyn Fn ( & mut HostConfig ) + Send + Sync + ' static > > ,
5253 #[ cfg( feature = "reusable-containers" ) ]
5354 pub ( crate ) reuse : crate :: ReuseDirective ,
5455 pub ( crate ) user : Option < String > ,
@@ -239,6 +240,12 @@ impl<I: Image> ContainerRequest<I> {
239240 self . health_check . as_ref ( )
240241 }
241242
243+ pub fn host_config_modifier (
244+ & self ,
245+ ) -> Option < & ( dyn Fn ( & mut HostConfig ) + Send + Sync + ' static ) > {
246+ self . host_config_modifier . as_deref ( )
247+ }
248+
242249 #[ cfg( feature = "device-requests" ) ]
243250 pub fn device_requests ( & self ) -> Option < & [ DeviceRequest ] > {
244251 self . device_requests . as_deref ( )
@@ -276,6 +283,7 @@ impl<I: Image> From<I> for ContainerRequest<I> {
276283 startup_timeout : None ,
277284 working_dir : None ,
278285 log_consumers : vec ! [ ] ,
286+ host_config_modifier : None ,
279287 #[ cfg( feature = "reusable-containers" ) ]
280288 reuse : crate :: ReuseDirective :: Never ,
281289 user : None ,
@@ -336,7 +344,11 @@ impl<I: Image + Debug> Debug for ContainerRequest<I> {
336344 . field ( "working_dir" , & self . working_dir )
337345 . field ( "user" , & self . user )
338346 . field ( "ready_conditions" , & self . ready_conditions )
339- . field ( "health_check" , & self . health_check ) ;
347+ . field ( "health_check" , & self . health_check )
348+ . field (
349+ "has_host_config_modifier" ,
350+ & self . host_config_modifier . is_some ( ) ,
351+ ) ;
340352
341353 #[ cfg( feature = "reusable-containers" ) ]
342354 repr. field ( "reusable" , & self . reuse ) ;
0 commit comments