GoogleContainerTools/skaffold · warning
cleaning up skaffold created network
Error message
cleaning up skaffold created network
What it means
During Cleanup, the verifier tries to remove the Docker network it created for verification. If skaffold created the network itself (networkFlagPassed is false) and NetworkRemove fails, this error wraps the docker API failure.
Source
Thrown at pkg/skaffold/verify/docker/verify.go:354
func (v *Verifier) Cleanup(ctx context.Context, out io.Writer, dryRun bool) error {
if dryRun {
for _, container := range v.tracker.DeployedContainers() {
output.Yellow.Fprintln(out, container.ID)
}
return nil
}
for _, container := range v.tracker.DeployedContainers() {
v.client.Stop(ctx, container.ID, nil)
if err := v.client.Remove(ctx, container.ID); err != nil {
olog.Entry(ctx).Debugf("cleaning up deployed container: %s", err.Error())
}
v.portManager.RelinquishPorts(container.ID)
}
if !v.networkFlagPassed {
err := v.client.NetworkRemove(ctx, v.network)
return errors.Wrap(err, "cleaning up skaffold created network")
}
return nil
}
func (v *Verifier) GetLogger() log.Logger {
return v.logger
}
func (v *Verifier) GetStatusMonitor() status.Monitor {
return v.monitor
}
func (v *Verifier) RegisterLocalImages([]graph.Artifact) {
// all images are local, so this is a noop
}
func (v *Verifier) timeout(duration *time.Duration) <-chan time.Time {
if duration != nil {View on GitHub (pinned to a1189de023)
Solutions
- Check for containers still attached: `docker network inspect <network>` and remove leftover containers
- If the network is already gone, the failure is benign — rerun cleanup or ignore
- Manually remove: `docker network rm <network>` after stopping leftover containers
- Report a bug if skaffold consistently leaks networks with active containers
Example fix
// before cleanup ordering issue: remove network while container alive // after: ensure container removal (and port release) happens before NetworkRemove
Defensive patterns
Strategy: try-catch
Validate before calling
// Detect stale network before cleanup
if _, err := exec.Command("docker", "network", "inspect", networkName).Output(); err != nil {
// network already gone; nothing to clean
return nil
} Try / catch
if err := verifier.Cleanup(ctx, out, ga); err != nil {
if strings.Contains(err.Error(), "cleaning up skaffold created network") {
log.Printf("network cleanup issue (possibly benign): %v", err)
exec.Command("docker", "network", "prune", "-f").Run()
return nil
}
return err
} Prevention
- Don't manually delete docker networks while a verify run is active
- Ensure all verify containers are stopped before network removal
- Periodically run `docker network prune` to clear leaked networks
When it happens
Trigger: Cleanup is called after verification and v.client.NetworkRemove(ctx, v.network) fails — network already removed, still in use by containers, or docker daemon errors.
Common situations: Verify containers not fully stopped/removed before network removal; user manually deleted the network mid-run; docker daemon restart lost network state; leaked containers holding the network.
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/ce6aea63622171eb.
Report an issue: GitHub.