func (s *Image) Run(cfg *RunConfig) (*Container, error) {
	args := make([]string, 0, len(cfg.Options)+len(cfg.Args)+1)
	args = append(args, cfg.Options...)
	args = append(args, s.name)
	args = append(args, cfg.Args...)

	out, err := s.docker.Run("run", args...)
	if err != nil {
		return nil, err
	}

	container := &Container{
		docker: s.docker,
		id:     strings.TrimSpace(out),
	}
	if container.id == "" {
		return nil, UnexpectedOutputError(
			"Unexpected empty output when running docker container")
	}

	return container, nil
}
func (s *Image) Run(cfg *RunConfig) (*Container, error) {
	args := make([]string, 0, len(cfg.Options)+len(cfg.Args)+1)
	args = append(args, cfg.Options...)
	args = append(args, s.name)
	args = append(args, cfg.Args...)

	out, err := s.docker.Run("run", args...)
	if err != nil {
		return nil, err
	}

	container := &Container{
		docker: s.docker,
		id:     strings.TrimSpace(out),
	}
	if container.id == "" {
		return nil, UnexpectedOutputError(
			"Unexpected empty output when running docker container")
	}

	return container, nil
}
func ( s * Image ) Run ( cfg * RunConfig ) ( * Container , error ) { args := make ( [ ] string , 0 , len ( cfg . Options ) + len ( cfg . Args ) + 1 ) args = append ( args , cfg . Options ... ) args = append ( args , s . name ) args = append ( args , cfg . Args ... ) out , err := s . docker . Run ( " " , args ... ) if err != nil { return nil , err } container := & Container { docker : s . docker , id : strings . TrimSpace ( out ) , } if container . id == " " { return nil , UnexpectedOutputError ( " " ) } return container , nil }
// Run creates a new Docker container as defined by current image and container
// template.
//
// Returns ExternalCmdError or UnexpectedOutputError on error.
Run creates a new Docker container as defined by current image and container template . Returns ExternalCmdError or UnexpectedOutputError on error .