Exemple #1
0
func (daemon *Daemon) CmdPush(job *engine.Job) error {
	remote := job.Args[0]
	tempConfig := &types.ImagePushConfig{}
	if err := job.GetenvJson("ImagePushConfig", tempConfig); err != nil {
		return err
	}
	imagePushConfig := &graph.ImagePushConfig{
		MetaHeaders: tempConfig.MetaHeaders,
		AuthConfig:  tempConfig.AuthConfig,
		Tag:         tempConfig.Tag,
		OutStream:   job.Stdout,
	}
	err := daemon.DockerCli.SendCmdPush(remote, imagePushConfig)
	if err != nil {
		return err
	}
	return nil
}
Exemple #2
0
func (daemon *Daemon) CmdPull(job *engine.Job) error {
	imgName := job.Args[0]
	tempConfig := &types.ImagePullConfig{}
	if err := job.GetenvJson("ImagePullConfig", tempConfig); err != nil {
		return err
	}
	config := &graph.ImagePullConfig{
		MetaHeaders: tempConfig.MetaHeaders,
		AuthConfig:  tempConfig.AuthConfig,
		OutStream:   job.Stdout,
	}
	cli := daemon.DockerCli
	_, _, err := cli.SendCmdPull(imgName, config)
	if err != nil {
		return err
	}
	return nil
}