예제 #1
0
파일: push.go 프로젝트: dnephin/dobi
func pushImage(ctx *context.ExecuteContext, t *Task, tag string) error {
	repo, err := parseAuthRepo(t.config.Image)
	if err != nil {
		return err
	}

	return Stream(os.Stdout, func(out io.Writer) error {
		return ctx.Client.PushImage(docker.PushImageOptions{
			Name:          tag,
			OutputStream:  out,
			RawJSONStream: true,
			// TODO: timeout
		}, ctx.GetAuthConfig(repo))
	})
}
예제 #2
0
파일: pull.go 프로젝트: dnephin/dobi
func pullImage(ctx *context.ExecuteContext, t *Task, imageTag string) error {
	registry, err := parseAuthRepo(t.config.Image)
	if err != nil {
		return err
	}

	repo, tag := docker.ParseRepositoryTag(imageTag)
	return Stream(os.Stdout, func(out io.Writer) error {
		return ctx.Client.PullImage(docker.PullImageOptions{
			Repository:    repo,
			Tag:           tag,
			OutputStream:  out,
			RawJSONStream: true,
			// TODO: timeout
		}, ctx.GetAuthConfig(registry))
	})
}