MCPcopy Index your code
hub / github.com/docker/cli / runDiskUsage

Function runDiskUsage

cli/command/system/df.go:43–70  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, opts diskUsageOptions)

Source from the content-addressed store, hash-verified

41}
42
43func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts diskUsageOptions) error {
44 // TODO expose types.DiskUsageOptions.Types as flag on the command-line and/or as separate commands (docker container df / docker container usage)
45 du, err := dockerCli.Client().DiskUsage(ctx, client.DiskUsageOptions{
46 Verbose: opts.verbose,
47 })
48 if err != nil {
49 return err
50 }
51
52 format := opts.format
53 if len(format) == 0 {
54 format = formatter.TableFormatKey
55 }
56
57 duCtx := formatter.DiskUsageContext{
58 Context: formatter.Context{
59 Output: dockerCli.Out(),
60 Format: formatter.NewDiskUsageFormat(format, opts.verbose),
61 },
62 Verbose: opts.verbose,
63 ImageDiskUsage: du.Images,
64 BuildCacheDiskUsage: du.BuildCache,
65 ContainerDiskUsage: du.Containers,
66 VolumeDiskUsage: du.Volumes,
67 }
68
69 return duCtx.Write()
70}

Callers 1

newDiskUsageCommandFunction · 0.85

Calls 3

WriteMethod · 0.95
ClientMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…