Closed keegancsmith closed 8 years ago
ping @vieux
what do you think @ehazlett
I end up writing this sort of boilerplate code whenever I'm interacting with the Docker daemon. In fact, I'm just about to write some now, which is why I decided to comment on the issue.
I could even see taking this one step further and creating a function that returns a new DockerClient based on the standard DOCKER_HOST
, DOCKER_CERT_PATH
and DOCKER_TLS_VERIFY
environment variables:
func NewDockerClientEnv() (*DockerClient, error)
The benefit is that we now have a reusable, canonical implementation for creating a docker client from the standard environment variables. Just my 2 cents though :smile:
Ya +1 to @bradrydzewski idea. This looks like a good start. LGTM
Docker TLS info is usually laid out in a specific way by docker.
TLSConfigFromCertPath
makes it easy to construct atls.Config
in that case. For example on OS XTLSConfigFromCertPath(os.Getenv("DOCKER_CERT_PATH"))
will give us a TLS Config to speak to the docker daemon.