nvwa/service/docker.go

29 lines
556 B
Go
Raw Permalink Normal View History

2018-08-29 17:58:41 +00:00
package service
import (
"context"
docker_client "github.com/docker/docker/client"
)
// Docker client
var Docker = newClient("tcp://server.yumc.pw:2376", "1.38")
type docker struct {
client *docker_client.Client
context context.Context
}
//Init the Docker Client
func newClient(host string, version string) *docker {
client, err := docker_client.NewClient(host, version, nil, nil)
if err != nil {
panic(err)
}
return &docker{client: client, context: context.TODO()}
}
func (d *docker) Version() string {
return d.client.ClientVersion()
}