IsContainerNameValid checks if the name of a container matches the right pattern
(containerName string)
| 750 | |
| 751 | // IsContainerNameValid checks if the name of a container matches the right pattern |
| 752 | func IsContainerNameValid(containerName string) bool { |
| 753 | pattern := "^" + ContainerNameRegexp + "$" |
| 754 | matched, err := regexp.MatchString(pattern, containerName) |
| 755 | if err != nil { |
| 756 | panicMsg := fmt.Sprintf("failed to parse regular expression for container name: %v", err) |
| 757 | panic(panicMsg) |
| 758 | } |
| 759 | |
| 760 | return matched |
| 761 | } |
| 762 | |
| 763 | func IsInsideContainer() bool { |
| 764 | return PathExists("/run/.containerenv") |
no outgoing calls
no test coverage detected
searching dependent graphs…