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 }
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 }
func setupTcpHttp(addr string, job *engine.Job) (*HttpServer, error) { r := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("CorsHeaders"), job.Getenv("Version")) l, err := newListener("tcp", addr, job.GetenvBool("BufferRequests")) if err != nil { return nil, err } if err := allocateDaemonPort(addr); err != nil { return nil, err } return &HttpServer{&http.Server{Addr: addr, Handler: r}, l}, nil }
func setupUnixHttp(addr string, job *engine.Job) (*HttpServer, error) { r := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("CorsHeaders"), job.Getenv("Version")) if err := syscall.Unlink(addr); err != nil && !os.IsNotExist(err) { return nil, err } mask := syscall.Umask(0777) defer syscall.Umask(mask) l, err := newListener("unix", addr, job.GetenvBool("BufferRequests")) if err != nil { return nil, err } if err := setSocketGroup(addr, job.Getenv("SocketGroup")); err != nil { return nil, err } if err := os.Chmod(addr, 0777); err != nil { return nil, err } return &HttpServer{&http.Server{Addr: addr, Handler: r}, l}, nil }