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

Method Push

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

Source from the content-addressed store, hash-verified

166}
167
168func (d Docker) Push(ctx context.Context, image string, user string, password string) (string, error) {
169 authConfig := types.AuthConfig{
170 Username: user,
171 Password: password,
172 }
173 encodedJSON, err := json.Marshal(authConfig)
174 if err != nil {
175 return "", err
176 }
177
178 authStr := base64.URLEncoding.EncodeToString(encodedJSON)
179 reader, err := d.client.ImagePush(ctx, image, types.ImagePushOptions{RegistryAuth: authStr})
180 if err != nil {
181 return "", err
182 }
183 buf := new(bytes.Buffer)
184 buf.ReadFrom(reader)
185 return buf.String(), err
186}
187
188func (d Docker) Exec(ctx context.Context, container string, chdir string, cmd []string, env []string) (string, error) {
189 id, err := d.client.ContainerExecCreate(ctx, container, types.ExecConfig{Tty: true, WorkingDir: chdir, Cmd: cmd, Env: env, AttachStderr: true, AttachStdout: true})

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected