mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2026-01-06 06:49:36 -05:00
providers/docker: ping docker server on startup
This commit is contained in:
parent
60c19680d7
commit
976410e44d
1 changed files with 13 additions and 1 deletions
14
provider.go
14
provider.go
|
|
@ -1,6 +1,8 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
|
@ -38,5 +40,15 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
|||
CertPath: d.Get("cert_path").(string),
|
||||
}
|
||||
|
||||
return config.NewClient()
|
||||
client, err := config.NewClient()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error initializing Docker client: %s", err)
|
||||
}
|
||||
|
||||
err = client.Ping()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error pinging Docker server: %s", err)
|
||||
}
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue