abiosoft/colima · error
container IP is empty
Error message
container IP is empty
What it means
getDockerModelRunnerIP succeeded at the docker inspect level but the templated output trimmed to an empty string: the container is attached to no network, or to networks that report no IPAddress. This happens when the container is created but not running, uses host networking, or was inspected before its network attachment completed.
Source
Thrown at model/docker.go:291
log.Infof("docker-model-runner not found, starting it (attempt %d/3)...", attempt)
_ = guest.Run("docker", "model", "start-runner")
time.Sleep(2 * time.Second)
}
return fmt.Errorf("could not start docker-model-runner after 3 attempts")
}
// getDockerModelRunnerIP returns the IP address of the docker-model-runner container.
func getDockerModelRunnerIP(guest environment.VM) (string, error) {
output, err := guest.RunOutput("docker", "inspect", "docker-model-runner",
"--format", "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}")
if err != nil {
return "", fmt.Errorf("failed to get container IP: %w", err)
}
ip := strings.TrimSpace(output)
if ip == "" {
return "", fmt.Errorf("container IP is empty")
}
return ip, nil
}
// startSocat starts socat in the background to forward a port to the container.
func startSocat(guest environment.VM, port int, containerIP string) error {
cmd := fmt.Sprintf("nohup socat TCP-LISTEN:%d,fork,reuseaddr TCP:%s:%d > /dev/null 2>&1 &",
port, containerIP, port)
return guest.Run("sh", "-c", cmd)
}
// stopSocat stops the socat process for a given port.
func stopSocat(guest environment.VM, port int) {
cmd := fmt.Sprintf("pkill -f 'socat.*TCP-LISTEN:%d' 2>/dev/null || true", port)
_ = guest.Run("sh", "-c", cmd)
}
View on GitHub (pinned to c3a5f9184d)
Solutions
- Confirm it is actually running: colima ssh -- docker ps | grep docker-model-runner (not just inspect-able)
- Restart the runner (docker model start-runner) and retry serve
- Inspect its networks manually: docker inspect docker-model-runner --format '{{json .NetworkSettings.Networks}}'
- If the runner legitimately has no IP (host networking), colima's socat forwarding needs a code fix — report/update colima
Example fix
// before: single shot
output, _ := guest.RunOutput("docker", "inspect", "docker-model-runner", "--format", tpl)
ip := strings.TrimSpace(output)
// after: brief retry while the container gets an IP
var ip string
for i := 0; i < 5; i++ {
output, _ := guest.RunOutput("docker", "inspect", "docker-model-runner", "--format", tpl)
if ip = strings.TrimSpace(output); ip != "" {
break
}
time.Sleep(time.Second)
} Defensive patterns
Strategy: retry
Validate before calling
// Require Running state (not just existence) before reading the IP.
func runnerReady(guest environment.VM) bool {
out, err := guest.RunOutput("docker", "inspect", "-f",
"{{.State.Running}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}",
"docker-model-runner")
return err == nil && strings.HasPrefix(strings.TrimSpace(out), "true ")
} Try / catch
ip := strings.TrimSpace(output)
for i := 0; ip == "" && i < 5; i++ {
time.Sleep(time.Second) // container may still be attaching to its network
output, err = guest.RunOutput("docker", "inspect", "docker-model-runner", "--format", tpl)
if err != nil { break }
ip = strings.TrimSpace(output)
}
if ip == "" { return "", fmt.Errorf("container IP is empty") } Prevention
- Check State.Running, not just container existence, before reading network settings
- Give freshly started runner containers a short grace period before querying their IP
- If the runner uses host networking (no IP by design), update colima's forwarding approach rather than retrying
When it happens
Trigger: docker-model-runner in Created/Exited state (inspect works, NetworkSettings empty); runner using host network mode with no bridge IP; inspect racing container start so the IP is not yet assigned.
Common situations: Runner container stopped after ensureDockerModelRunner's coarse check; newer runner images switching network modes; freshly started containers on slow VMs.
Related errors
- failed to get container IP: %w
- no models available Pull a model first: colima model pull ai
- failed to read model manifest: %w
- failed to parse model manifest: %w
- failed to create bundle directory: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/e21bcad4f2b1a55d.
Report an issue: GitHub.