code: func inspectContainer(client *sshClient, container string) (*containerInfos, error) {
  	// Check whether there's a container running for the service
  	out, err := client.Run(fmt.Sprintf("docker inspect %s", container))
  	if err != nil {
  		return nil, ErrServiceUnknown
  	}
  	// If yes, extract various configuration options
  	type inspection struct {
  		State struct {
  			Running bool
  		}
  		Mounts []struct {
  			Source      string
  			Destination string
  		}
  		Config struct {
  			Env []string
  		}
  		HostConfig struct {
  			PortBindings map[string][]map[string]string
  		}
  	}
  	var inspects []inspection
  	if err = json.Unmarshal(out, &inspects); err != nil {
  		return nil, err
  	}
  	inspect := inspects[0]
  
  	// Infos retrieved, parse the above into something meaningful
  	infos := &containerInfos{
  		running: inspect.State.Running,
  		envvars: make(map[string]string),
  		portmap: make(map[string]int),
  		volumes: make(map[string]string),
  	}
  	for _, envvar := range inspect.Config.Env {
  		if parts := strings.Split(envvar, "="); len(parts) == 2 {
  			infos.envvars[parts[0]] = parts[1]
  		}
  	}
  	for portname, details := range inspect.HostConfig.PortBindings {
  		if len(details) > 0 {
  			port, _ := strconv.Atoi(details[0]["HostPort"])
  			infos.portmap[portname] = port
  		}
  	}
  	for _, mount := range inspect.Mounts {
  		infos.volumes[mount.Destination] = mount.Source
  	}
  	return infos, err
  }
docs: // inspectContainer runs docker inspect against a running container