MCPcopy Index your code
hub / github.com/docker/docker-agent / runSandboxListCommand

Function runSandboxListCommand

cmd/root/sandbox_cmd.go:137–161  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

135}
136
137func runSandboxListCommand(cmd *cobra.Command, args []string) (commandErr error) {
138 telemetry.TrackCommand(cmd.Context(), "sandbox", []string{"list"})
139 defer func() {
140 telemetry.TrackCommandError(cmd.Context(), "sandbox", []string{"list"}, commandErr)
141 }()
142
143 out := cli.NewPrinter(cmd.OutOrStdout())
144
145 cfg, err := userconfig.Load()
146 if err != nil {
147 return fmt.Errorf("failed to load config: %w", err)
148 }
149
150 if len(cfg.SandboxAllowlist) == 0 {
151 out.Println("Persistent sandbox allowlist is empty.")
152 out.Println("\nAdd a host with: docker agent sandbox allow <host>")
153 return nil
154 }
155
156 out.Printf("Persistent sandbox allowlist (%d):\n\n", len(cfg.SandboxAllowlist))
157 for _, h := range cfg.SandboxAllowlist {
158 out.Printf(" %s\n", h)
159 }
160 return nil
161}

Callers

nothing calls this directly

Calls 7

PrintlnMethod · 0.95
PrintfMethod · 0.95
TrackCommandFunction · 0.92
TrackCommandErrorFunction · 0.92
NewPrinterFunction · 0.92
LoadFunction · 0.92
ContextMethod · 0.80

Tested by

no test coverage detected