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

Function runLogs

cli/command/container/logs.go:56–83  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, opts *logsOptions)

Source from the content-addressed store, hash-verified

54}
55
56func runLogs(ctx context.Context, dockerCli command.Cli, opts *logsOptions) error {
57 c, err := dockerCli.Client().ContainerInspect(ctx, opts.container, client.ContainerInspectOptions{})
58 if err != nil {
59 return err
60 }
61
62 resp, err := dockerCli.Client().ContainerLogs(ctx, c.Container.ID, client.ContainerLogsOptions{
63 ShowStdout: true,
64 ShowStderr: true,
65 Since: opts.since,
66 Until: opts.until,
67 Timestamps: opts.timestamps,
68 Follow: opts.follow,
69 Tail: opts.tail,
70 Details: opts.details,
71 })
72 if err != nil {
73 return err
74 }
75 defer func() { _ = resp.Close() }()
76
77 if c.Container.Config.Tty {
78 _, err = io.Copy(dockerCli.Out(), resp)
79 } else {
80 _, err = stdcopy.StdCopy(dockerCli.Out(), dockerCli.Err(), resp)
81 }
82 return err
83}

Callers 2

newLogsCommandFunction · 0.70
TestRunLogsFunction · 0.70

Calls 6

ContainerInspectMethod · 0.80
ContainerLogsMethod · 0.80
ClientMethod · 0.65
OutMethod · 0.65
ErrMethod · 0.65
CloseMethod · 0.45

Tested by 1

TestRunLogsFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…