예제 #1
0
파일: empire.go 프로젝트: aaithal/empire
func newResolver(o DockerOptions) (Resolver, error) {
	if o.Socket == "" {
		log.Println("warn: docker socket not configured, docker image puller disabled.")
		return &fakeResolver{}, nil
	}

	c, err := dockerutil.NewClient(o.Auth, o.Socket, o.CertPath)
	return newDockerResolver(c), err
}
예제 #2
0
func newDockerClient(c *cli.Context) (*dockerutil.Client, error) {
	socket := c.String(FlagDockerSocket)
	certPath := c.String(FlagDockerCert)
	auth, err := dockerAuth(c.String(FlagDockerAuth))
	if err != nil {
		return nil, err
	}

	return dockerutil.NewClient(auth, socket, certPath)
}
예제 #3
0
// newTestDockerClient returns a docker.Client configured to talk to the given http.Handler
func newTestDockerClient(t *testing.T, fakeDockerAPI http.Handler) (*dockerutil.Client, *httptest.Server) {
	s := httptest.NewServer(fakeDockerAPI)

	c, err := dockerutil.NewClient(nil, s.URL, "")
	if err != nil {
		t.Fatal(err)
	}

	return c, s
}
예제 #4
0
파일: factories.go 프로젝트: iserko/empire
func newDockerClient(c *Context) (*dockerutil.Client, error) {
	socket := c.String(FlagDockerSocket)
	certPath := c.String(FlagDockerCert)
	authProvider, err := newAuthProvider(c)
	if err != nil {
		return nil, err
	}

	return dockerutil.NewClient(authProvider, socket, certPath)
}
예제 #5
0
파일: empire.go 프로젝트: aaithal/empire
func newRunner(o DockerOptions) (*runner.Runner, error) {
	if o.Socket == "" {
		return nil, nil
	}

	c, err := dockerutil.NewClient(o.Auth, o.Socket, o.CertPath)
	if err != nil {
		return nil, err
	}

	return runner.NewRunner(c), nil
}