Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker api enforces tls from docker 1.13 onwards #80

Merged
merged 3 commits into from
Feb 24, 2017
Merged
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
19 changes: 18 additions & 1 deletion dockertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ func (r *Resource) GetPort(id string) string {
return m[0].HostPort
}

// NewTLSPool creates a new pool given an endpoint and the certificate path. This is required for endpoints that
// require TLS communication.
func NewTLSPool(endpoint, certpath string) (*Pool, error) {
ca := fmt.Sprintf("%s/ca.pem", certpath)
cert := fmt.Sprintf("%s/cert.pem", certpath)
key := fmt.Sprintf("%s/key.pem", certpath)

client, err := dc.NewTLSClient(endpoint, cert, key, ca)
if err != nil {
return nil, errors.Wrap(err, "")
}

return &Pool{
Client: client,
}, nil
}

// NewPool creates a new pool. You can pass an empty string to use the default, which is taken from the environment
// variable DOCKER_URL or if that is not defined a sensible default for the operating system you are on.
func NewPool(endpoint string) (*Pool, error) {
Expand All @@ -51,7 +68,7 @@ func NewPool(endpoint string) (*Pool, error) {
endpoint = "unix:///var/run/docker.sock"
}
}

client, err := dc.NewClient(endpoint)
if err != nil {
return nil, errors.Wrap(err, "")
Expand Down