oci: do not use hooks in rootless mode
Closes:
Approved by: mheon
@@ -1173,9 +1173,11 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}
var err error
+ if os.Getuid() == 0 {
if c.state.ExtensionStageHooks, err = c.setupOCIHooks(ctx, &g); err != nil {
return nil, errors.Wrapf(err, "error setting up OCI Hooks")
}
+ }
// Bind builtin image volumes
if c.config.Rootfs == "" && c.config.ImageVolumes {
if err := c.addImageVolumes(ctx, &g); err != nil {
