GoogleContainerTools/skaffold · error
inspecting init container
Error message
inspecting init container
What it means
Immediately after creating a debug init container, Skaffold inspects it with d.client.ContainerInspect to discover its mounts (it expects exactly one, the shared debug volume). If the inspect call itself fails — container removed, daemon error, connection lost — the error is wrapped with this message.
Source
Thrown at pkg/skaffold/deploy/docker/deploy.go:286
})
if err != nil {
return nil, err
}
m := d.createMount(v, labels)
// create the init container
c.Labels = labels
_, _, id, err := d.client.Run(ctx, out, dockerutil.ContainerCreateOpts{
ContainerConfig: c,
Mounts: []mount.Mount{m},
})
if err != nil {
return nil, errors.Wrap(err, "creating container in local docker")
}
r, err := d.client.ContainerInspect(ctx, id)
if err != nil {
return nil, errors.Wrap(err, "inspecting init container")
}
if len(r.Mounts) != 1 {
olog.Entry(ctx).Warnf("unable to retrieve mount from debug init container: debugging may not work correctly!")
}
// we know there is only one mount point, since we generated the init container config ourselves
d.debugger.AddSupportMount(c.Image, m)
}
bindings := make(network.PortMap)
config := d.debugger.ConfigurationForImage(containerCfg.Image)
for _, port := range config.Ports {
p, err := network.ParsePort(fmt.Sprint(port) + "/tcp")
if err != nil {
return nil, err
}
bindings[p] = []network.PortBinding{
{HostIP: netip.MustParseAddr("127.0.0.1"), HostPort: fmt.Sprint(port)},
}View on GitHub (pinned to a1189de023)
Solutions
- Retry `skaffold debug` — often transient (daemon restart or racing cleanup)
- Check `docker events`/daemon logs around the failure time to see why the container vanished
- Ensure only one skaffold process manages the deployment (concurrent runs delete each other's containers)
- Verify daemon stability: `docker info` and Docker Desktop/colima health
- If reproducible, capture the wrapped inspect error and file it with `skaffold diagnose` output
Example fix
// before error: inspecting init container: Error: No such container: <id> // after $ skaffold delete $ skaffold debug # single clean run, no concurrent skaffold processes
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
if err := deploy(ctx); err != nil && strings.Contains(err.Error(), "inspecting init container") {
log.Printf("transient inspect failure (%v); retrying once", err)
err = deploy(ctx)
} Prevention
- Run only one skaffold process per daemon to avoid racing cleanups
- Keep the Docker daemon from auto-restarting mid-deploy (disable aggressive Docker Desktop restarts)
- Check daemon logs if failures recur
- Retry the deploy — inspect failures right after create are usually transient
When it happens
Trigger: setupDebugging calls d.client.ContainerInspect(ctx, id) right after a successful container create; inspect fails because the container exited/was auto-removed, the daemon restarted between create and inspect, or the Docker API connection dropped.
Common situations: An `--rm`-like auto-removal or a competing cleanup deleting the container between create and inspect; Docker daemon crash/restart mid-deploy; very short-lived init container removed by another skaffold process.
Related errors
- transforming image for debugging
- pulling init container image
- %q running container image %q errored during run with status
- docker deployment not supported alongside cluster deployment
- INIT_DOCKER_NETWORK_INVALID_MODE
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/49c804ee30c09c6d.
Report an issue: GitHub.