func newContainerProxy(name string, client docker.Docker) (*containerProxy, error) {
	container, err := client.FetchContainer(name)
	if container == nil || err != nil || !container.State.Running {
		return nil, fmt.Errorf("Container %s does not exist or is not running, skipping for now", name)
	}
	ip := container.NetworkSettings.IpAddress
	ports := container.NetworkSettings.Ports
	if len(ports) == 0 {
		return nil, fmt.Errorf("No ports to proxy for %s", name)
	}
	var proxies []proxy.Proxy
	for key, _ := range ports {
		port, proto := utils.SplitPort(key)
		p, err := newProxy(proto, ip, port)
		if err != nil {
			log.Info("Error creating proxy for %s %s:%s - %v", name, ip, port, err)
			continue
		}
		proxies = append(proxies, p)
	}
	if len(proxies) == 0 {
		return nil, fmt.Errorf("Error creating proxies for container %s", name)
	}
	return &containerProxy{id: container.Id, name: name, s: proxies}, nil
}
func proxyContainer(container *docker.Container, proxyChan chan net.Listener) error {
	ip := container.NetworkSettings.IpAddress
	ports := container.NetworkSettings.Ports
	if len(ports) != 0 {
		for key, _ := range ports {
			port, proto := utils.SplitPort(key)
			local := fmt.Sprintf("%v://0.0.0.0:%v", proto, port)
			remote := fmt.Sprintf("%v://%v:%v", proto, ip, port)
			out := fmt.Sprintf("Proxying %s:%s/%s", ip, port, proto)
			log.Printf(out)
			srv, err := gocat.NewProxy(local, remote)
			if err != nil {
				return err
			}
			proxyChan <- srv
		}
	}
	close(proxyChan)
	return nil
}