fixed getContainerId() function

* since switching to podman builds in the CI, the getContainerId()
  function wasn't working anymore. As per default the hostname of the
  container is the same as the container id, we use the GetHostname()
  function to get the container id inside the container.
This commit is contained in:
Bernhard B 2025-08-26 23:15:47 +02:00
parent f52f177a72
commit 5330e0dff5

View File

@ -288,16 +288,7 @@ func parseWhitespaceDelimitedKeyValueStringList(in string, keys []string) []map[
} }
func getContainerId() (string, error) { func getContainerId() (string, error) {
data, err := ioutil.ReadFile("/proc/1/cpuset") return os.Hostname()
if err != nil {
return "", err
}
lines := strings.Split(string(data), "\n")
if len(lines) == 0 {
return "", errors.New("Couldn't get docker container id (empty)")
}
containerId := strings.Replace(lines[0], "/docker/", "", -1)
return containerId, nil
} }
func ConvertGroupIdToInternalGroupId(id string) (string, error) { func ConvertGroupIdToInternalGroupId(id string) (string, error) {