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

Function attach

cli/command/swarm/ca.go:113–140  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, opts caOptions)

Source from the content-addressed store, hash-verified

111}
112
113func attach(ctx context.Context, dockerCLI command.Cli, opts caOptions) error {
114 apiClient := dockerCLI.Client()
115 errChan := make(chan error, 1)
116 pipeReader, pipeWriter := io.Pipe()
117
118 go func() {
119 errChan <- progress.RootRotationProgress(ctx, apiClient, pipeWriter)
120 }()
121
122 if opts.quiet {
123 go io.Copy(io.Discard, pipeReader)
124 return <-errChan
125 }
126
127 err := jsonstream.Display(ctx, pipeReader, dockerCLI.Out())
128 if err == nil {
129 err = <-errChan
130 }
131 if err != nil {
132 return err
133 }
134
135 res, err := apiClient.SwarmInspect(ctx, client.SwarmInspectOptions{})
136 if err != nil {
137 return err
138 }
139 return displayTrustRoot(dockerCLI.Out(), res)
140}
141
142func displayTrustRoot(out io.Writer, info client.SwarmInspectResult) error {
143 if info.Swarm.ClusterInfo.TLSInfo.TrustRoot == "" {

Callers 1

runCAFunction · 0.85

Calls 4

displayTrustRootFunction · 0.85
SwarmInspectMethod · 0.80
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…