Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Add option for custom Docker TLS config #531

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docker/client/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package client

import (
"crypto/tls"
"fmt"
"net/http"
"os"
Expand Down Expand Up @@ -37,6 +38,7 @@ func init() {
type Options struct {
TLS bool
TLSVerify bool
TLSConfig *tls.Config
TLSOptions tlsconfig.Options
TrustKey string
Host string
Expand Down Expand Up @@ -82,14 +84,17 @@ func Create(c Options) (client.APIClient, error) {

var httpClient *http.Client
if c.TLS {
config, err := tlsconfig.Client(c.TLSOptions)
if err != nil {
return nil, err
if c.TLSConfig == nil {
var err error
c.TLSConfig, err = tlsconfig.Client(c.TLSOptions)
if err != nil {
return nil, err
}
}

httpClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: config,
TLSClientConfig: c.TLSConfig,
},
}
}
Expand Down