MCPcopy
hub / github.com/dgraph-io/dgraph / cleanupDocker

Method cleanupDocker

dgraphtest/local_cluster.go:457–487  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

455}
456
457func (c *LocalCluster) cleanupDocker() error {
458 ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
459 defer cancel()
460 // Prune containers
461 contsReport, err := c.dcli.ContainersPrune(ctx, filters.Args{})
462 if err != nil {
463 // Don't fail if prune is already running - just skip it
464 if strings.Contains(err.Error(), "already running") {
465 log.Printf("[WARNING] Skipping container prune - operation already running")
466 } else {
467 log.Printf("[WARNING] Error pruning containers: %v", err)
468 }
469 } else {
470 log.Printf("[INFO] Pruned containers: %+v\n", contsReport)
471 }
472
473 // Prune networks
474 netsReport, err := c.dcli.NetworksPrune(ctx, filters.Args{})
475 if err != nil {
476 // Don't fail if prune is already running - just skip it
477 if strings.Contains(err.Error(), "already running") {
478 log.Printf("[WARNING] Skipping network prune - operation already running")
479 } else {
480 log.Printf("[WARNING] Error pruning networks: %v", err)
481 }
482 } else {
483 log.Printf("[INFO] Pruned networks: %+v\n", netsReport)
484 }
485
486 return nil
487}
488
489func (c *LocalCluster) Start() error {
490 log.Printf("[INFO] starting cluster with prefix [%v]", c.conf.prefix)

Callers 1

StartMethod · 0.95

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected