-
Notifications
You must be signed in to change notification settings - Fork 688
Expand file tree
/
Copy pathcommand.go
More file actions
65 lines (57 loc) · 1.85 KB
/
command.go
File metadata and controls
65 lines (57 loc) · 1.85 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package command
import (
"context"
"io"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
)
type Command interface {
// Pull pulls an image from a remote registry and returns the inspect response for the local image.
// If the image already exists, it will return the inspect response for the local image without pulling.
// When force is true, it will always attempt to pull the image.
Pull(ctx context.Context, ref string, force bool) (*image.InspectResponse, error)
Push(ctx context.Context, ref string) error
LoadUserInformation(ctx context.Context, registryHost string) (*UserInfo, error)
Inspect(ctx context.Context, ref string) (*image.InspectResponse, error)
ImageExists(ctx context.Context, ref string) (bool, error)
ContainerLogs(ctx context.Context, containerID string, w io.Writer) error
ContainerInspect(ctx context.Context, id string) (*container.InspectResponse, error)
ContainerStop(ctx context.Context, containerID string) error
ImageBuild(ctx context.Context, options ImageBuildOptions) error
Run(ctx context.Context, options RunOptions) error
ContainerStart(ctx context.Context, options RunOptions) (string, error)
}
type ImageBuildOptions struct {
// Platform string
WorkingDir string
DockerfileContents string
ImageName string
Secrets []string
NoCache bool
ProgressOutput string
Epoch *int64
ContextDir string
BuildContexts map[string]string
Labels map[string]string
}
type RunOptions struct {
Detach bool
Args []string
Env []string
GPUs string
Image string
Ports []Port
Volumes []Volume
Workdir string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
type Port struct {
HostPort int
ContainerPort int
}
type Volume struct {
Source string
Destination string
}