func NewEnvClient() (*Client, error) {
	var client *http.Client
	if dockerCertPath := os.Getenv("DOCKER_CERT_PATH"); dockerCertPath != "" {
		options := tlsconfig.Options{
			CAFile:             filepath.Join(dockerCertPath, "ca.pem"),
			CertFile:           filepath.Join(dockerCertPath, "cert.pem"),
			KeyFile:            filepath.Join(dockerCertPath, "key.pem"),
			InsecureSkipVerify: os.Getenv("DOCKER_TLS_VERIFY") == "",
		}
		tlsc, err := tlsconfig.Client(options)
		if err != nil {
			return nil, err
		}
		client = &http.Client{
			Transport: &http.Transport{
				TLSClientConfig: tlsc,
			},
		}
	}
	host := os.Getenv("DOCKER_HOST")
	if host == "" {
		host = DefaultDockerHost
	}
	version := os.Getenv("DOCKER_API_VERSION")
	if version == "" {
		version = DefaultVersion
	}
	return NewClient(host, version, client, nil)
}
NewEnvClient initializes a new API client based on environment variables.
Use DOCKER_HOST to set the url to the docker server.
Use DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
Use DOCKER_CERT_PATH to load the tls certificates from.
Use DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
package client
import (
	"fmt"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strings"
	"github.com/docker/engine-api/client/transport"
	"github.com/docker/go-connections/tlsconfig"
)
const DefaultVersion string = "1.23"
type Client struct {
	host string
	proto string
	addr string
	basePath string
	transport transport.Client
	version string
	customHTTPHeaders map[string]string
}