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