[release] v0.16.0-unstable29

This commit is contained in:
Yann Stepienik
2024-09-11 20:04:14 +01:00
parent c93820da4c
commit ef12315e91
+12 -10
View File
@@ -920,18 +920,20 @@ func GetEnv(env []string, key string) string {
}
func IsInsideContainer() {
errD := Connect()
if errD != nil {
utils.Error("isInsideContainer", errD)
return
}
if os.Getenv("HOSTNAME") != "" {
errD := Connect()
if errD != nil {
utils.Error("isInsideContainer", errD)
return
}
container, err := DockerClient.ContainerInspect(DockerContext, os.Getenv("HOSTNAME"))
container, err := DockerClient.ContainerInspect(DockerContext, os.Getenv("HOSTNAME"))
if err == nil {
// check image
if strings.Contains(container.Config.Image, "cosmos") {
utils.IsInsideContainer = true
if err == nil {
// check image
if strings.Contains(container.Config.Image, "cosmos") {
utils.IsInsideContainer = true
}
}
}
}