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

Function pullImage

cli/command/container/create.go:135–162  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, img string, options *createOptions)

Source from the content-addressed store, hash-verified

133}
134
135func pullImage(ctx context.Context, dockerCLI command.Cli, img string, options *createOptions) error {
136 encodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCLI.ConfigFile(), img)
137 if err != nil {
138 return err
139 }
140
141 var ociPlatforms []ocispec.Platform
142 if options.platform != "" {
143 // Already validated.
144 ociPlatforms = append(ociPlatforms, platforms.MustParse(options.platform))
145 }
146 resp, err := dockerCLI.Client().ImagePull(ctx, img, client.ImagePullOptions{
147 RegistryAuth: encodedAuth,
148 Platforms: ociPlatforms,
149 })
150 if err != nil {
151 return err
152 }
153 defer func() {
154 _ = resp.Close()
155 }()
156
157 out := dockerCLI.Err()
158 if options.quiet {
159 out = streams.NewOut(io.Discard)
160 }
161 return jsonstream.Display(ctx, resp, out)
162}
163
164type cidFile struct {
165 path string

Callers 1

createContainerFunction · 0.85

Calls 5

ConfigFileMethod · 0.65
ClientMethod · 0.65
ErrMethod · 0.65
ImagePullMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…