GoogleContainerTools/skaffold · warning
cleaning up skaffold created network
Error message
cleaning up skaffold created network
What it means
If the deployer created a dedicated Docker network, Cleanup removes it with d.client.NetworkRemove, but only when d.networkDeployed is true. A failure removing the network (endpoints still attached, already gone, daemon error) is wrapped with this message.
Source
Thrown at pkg/skaffold/deploy/docker/deploy.go:378
}
return nil
}
for _, container := range d.tracker.DeployedContainers() {
if err := d.client.Delete(ctx, out, container.ID); err != nil {
// TODO(nkubala): replace with actionable error
return errors.Wrap(err, "cleaning up deployed container")
}
d.portManager.RelinquishPorts(container.ID)
}
for _, m := range d.debugger.SupportMounts() {
if err := d.client.VolumeRemove(ctx, m.Source); err != nil {
return errors.Wrap(err, "cleaning up debug support volume")
}
}
if err := d.client.NetworkRemove(ctx, d.network); d.networkDeployed && err != nil {
return errors.Wrap(err, "cleaning up skaffold created network")
}
return d.cleanPreviousDeployments(ctx)
}
func (d *Deployer) cleanPreviousDeployments(ctx context.Context) error {
ctd, err := d.containersToDelete(ctx)
if err != nil {
return err
}
ntd, err := d.networksToDelete(ctx, ctd)
if err != nil {
return err
}
vtd := d.volumesToDelete(ctd)
View on GitHub (pinned to a1189de023)
Solutions
- Disconnect/remove remaining containers first: `docker network inspect <network>` to see attached endpoints
- Run `docker network rm <network>` manually, or `docker network prune`
- Re-run `skaffold delete` once the container cleanup succeeds
- If the network is already gone, the leftover error is harmless — ignore or upgrade skaffold to tolerate 404
- Avoid running concurrent skaffold sessions against the same network
Example fix
// before error: cleaning up skaffold created network: Error response from daemon: network <id> has active endpoints // after $ docker network inspect <network> # find endpoints $ docker rm -f <endpoint-container> $ docker network rm <network> $ skaffold delete
Defensive patterns
Strategy: try-catch
Validate before calling
if out, err := exec.Command("docker", "network", "inspect", d.network).CombinedOutput(); err != nil {
log.Printf("network already absent or uninspectable: %s", out) // nothing to clean
} Type guard
null
Try / catch
if err := deployer.Cleanup(ctx, out); err != nil && strings.Contains(err.Error(), "cleaning up skaffold created network") {
log.Printf("network cleanup deferred: %v", err)
exec.Command("docker", "network", "prune", "-f").Run()
} Prevention
- Fix container cleanup first — attached endpoints block network removal
- Don't run concurrent skaffold sessions sharing a network
- Avoid manual `docker network rm` of the skaffold network
- Re-run `skaffold delete` or `docker network prune` afterwards
When it happens
Trigger: Deployer.Cleanup reaches d.client.NetworkRemove(ctx, d.network) with d.networkDeployed == true and the daemon returns an error — typically because containers are still connected to the network or it was already deleted.
Common situations: Containers still attached because earlier cleanup steps (containers) failed; network manually deleted with `docker network rm`; two skaffold instances sharing one network race to delete it; daemon down during cleanup.
Related errors
- cleaning up skaffold created network
- INIT_DOCKER_NETWORK_CONTAINER_DOES_NOT_EXIST
- creating skaffold network %s: %w
- pruning removed container: %w
- unable to stream build output: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/be72102d0ec8701e.
Report an issue: GitHub.