@@ -318,7 +318,7 @@ rootless=%d
318
318
}
319
319
320
320
// Setup OCI hooks
321
- _ , err = b .setupOCIHooks (spec , (len (options .Mounts ) > 0 || len (volumes ) > 0 ))
321
+ _ , err = b .setupOCIHooks (spec , path , (len (options .Mounts ) > 0 || len (volumes ) > 0 ))
322
322
if err != nil {
323
323
return fmt .Errorf ("unable to setup OCI hooks: %w" , err )
324
324
}
@@ -379,7 +379,7 @@ rootless=%d
379
379
return err
380
380
}
381
381
382
- func (b * Builder ) setupOCIHooks (config * specs.Spec , hasVolumes bool ) (map [string ][]specs.Hook , error ) {
382
+ func (b * Builder ) setupOCIHooks (config * specs.Spec , bundlePath string , hasVolumes bool ) (map [string ][]specs.Hook , error ) {
383
383
allHooks := make (map [string ][]specs.Hook )
384
384
if len (b .CommonBuildOpts .OCIHooksDir ) == 0 {
385
385
if unshare .IsRootless () {
@@ -416,7 +416,15 @@ func (b *Builder) setupOCIHooks(config *specs.Spec, hasVolumes bool) (map[string
416
416
}
417
417
}
418
418
419
- hookErr , err := hooksExec .RuntimeConfigFilter (context .Background (), allHooks ["precreate" ], config , hooksExec .DefaultPostKillTimeout ) //nolint:staticcheck
419
+ hookErr , err := hooksExec .RuntimeConfigFilterWithOptions (
420
+ context .Background (),
421
+ hooksExec.RuntimeConfigFilterOptions {
422
+ Hooks : allHooks ["precreate" ],
423
+ Dir : bundlePath ,
424
+ Config : config ,
425
+ PostKillTimeout : hooksExec .DefaultPostKillTimeout ,
426
+ },
427
+ )
420
428
if err != nil {
421
429
logrus .Warnf ("Container: precreate hook: %v" , err )
422
430
if hookErr != nil && hookErr != err {
0 commit comments