-
Notifications
You must be signed in to change notification settings - Fork 170
/
image.go
39 lines (34 loc) · 1.04 KB
/
image.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package dockerclient
import (
docker "github.com/Dataman-Cloud/go-dockerclient"
"golang.org/x/net/context"
)
func (client *CraneDockerClient) ListImages(ctx context.Context, opts docker.ListImagesOptions) ([]docker.APIImages, error) {
swarmNode, err := client.SwarmNode(ctx)
if err != nil {
return nil, err
}
return swarmNode.ListImages(opts)
}
func (client *CraneDockerClient) InspectImage(ctx context.Context, imageID string) (*docker.Image, error) {
swarmNode, err := client.SwarmNode(ctx)
if err != nil {
return nil, err
}
return swarmNode.InspectImage(imageID)
}
func (client *CraneDockerClient) ImageHistory(ctx context.Context, imageID string) ([]docker.ImageHistory, error) {
swarmNode, err := client.SwarmNode(ctx)
if err != nil {
return nil, err
}
return swarmNode.ImageHistory(imageID)
}
// TODO add remove image option
func (client *CraneDockerClient) RemoveImage(ctx context.Context, imageID string) error {
swarmNode, err := client.SwarmNode(ctx)
if err != nil {
return err
}
return swarmNode.RemoveImage(imageID)
}