Toma Puljak bf349e88a0
feat(runner): inter-sandbox network enabled config (#4122)
Signed-off-by: Toma Puljak <toma.puljak@hotmail.com>
2026-03-24 15:58:59 +01:00

35 lines
737 B
Go

// Copyright 2025 Daytona Platforms Inc.
// SPDX-License-Identifier: AGPL-3.0
package docker
import (
"context"
"github.com/docker/docker/api/types/container"
)
func GetContainerIpAddress(ctx context.Context, container *container.InspectResponse) string {
if container == nil {
return ""
}
if container.NetworkSettings == nil {
return ""
}
if container.NetworkSettings.Networks == nil {
return ""
}
if networkSettings, ok := container.NetworkSettings.Networks[RUNNER_BRIDGE_NETWORK_NAME]; ok && networkSettings != nil {
return networkSettings.IPAddress
}
if networkSettings, ok := container.NetworkSettings.Networks["bridge"]; ok && networkSettings != nil {
return networkSettings.IPAddress
}
return ""
}