diff --git a/server/container_create.go b/server/container_create.go index 0c4a3c80..2de24f67 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -757,6 +757,18 @@ func (s *Server) setupOCIHooks(specgen *generate.Generator, sb *sandbox.Sandbox, } } for _, annotationRegex := range hook.Annotations { + for _, annotation := range containerConfig.GetAnnotations() { + match, err := regexp.MatchString(annotationRegex, annotation) + if err != nil { + logrus.Errorf("Invalid regex %q:%q", annotationRegex, err) + continue + } + if match { + if err := addHook(hook); err != nil { + return err + } + } + } for _, annotation := range sb.Annotations() { match, err := regexp.MatchString(annotationRegex, annotation) if err != nil {