MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / Pull

Method Pull

cli/pkg/common/docker.go:49–67  ·  view source on GitHub ↗
(ctx context.Context, image, user, password string)

Source from the content-addressed store, hash-verified

47}
48
49func (d Docker) Pull(ctx context.Context, image, user, password string) (string, error) {
50 authConfig := types.AuthConfig{
51 Username: user,
52 Password: password,
53 }
54 encodedJSON, err := json.Marshal(authConfig)
55 if err != nil {
56 return "", err
57 }
58
59 authStr := base64.URLEncoding.EncodeToString(encodedJSON)
60 reader, err := d.client.ImagePull(ctx, image, types.ImagePullOptions{RegistryAuth: authStr})
61 if err != nil {
62 return "", err
63 }
64 buf := new(bytes.Buffer)
65 _, _ = buf.ReadFrom(reader)
66 return buf.String(), nil
67}
68
69func (d Docker) Import(ctx context.Context, file string, image string) (string, error) {
70 f, err := os.Open(file)

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected