-
Notifications
You must be signed in to change notification settings - Fork 5
/
iface.go
60 lines (55 loc) · 1.57 KB
/
iface.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package docker
import (
"io"
)
// Iface is an interface for interracting with docker.
type Iface interface {
Run(options *RunOptions) error
EnsureImage(image string, outputStream io.Writer) error
PullImage(image string, outputStream io.Writer) error
GetImageRepoDigests(image string) ([]string, error)
Exec(options *ExecOptions) error
Stop(id string, timeout int) error
CreateVolume(name string) (string, error)
VolumeExists(name string) (bool, error)
RemoveVolume(id string) error
CreateContainer(options *CreateContainerOptions) (string, error)
RemoveContainer(id string) error
CopyFromContainer(id, path string) (io.ReadCloser, error)
CopyToContainer(id, path string, reader io.Reader) error
SetDebugVolume(volume string)
}
// RunOptions represents the options to the Run method.
type RunOptions struct {
Image string
WorkingDir string
Entrypoint []string
Cmd []string
Env []string
Binds []string
NamePrefix string
InputStream io.Reader
OutputStream io.Writer
ErrorStream io.Writer
Started chan string
Init bool
SuccessStatus int
BeforeRemove func(id string) error
}
// CreateContainerOptions represents the options to the CreateContainer method.
type CreateContainerOptions struct {
Image string
Binds []string
}
// ExecOptions represents options to the Exec method.
type ExecOptions struct {
ID string
Cmd []string
Env map[string]string
InputStream io.Reader
OutputStream io.Writer
ErrorStream io.Writer
Tty bool
Interactive bool
WorkingDir string
}