-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.go
40 lines (32 loc) · 1.08 KB
/
docker.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
package main
import (
"github.com/fsouza/go-dockerclient"
)
func listImages(options docker.ListImagesOptions) ([]docker.APIImages, error) {
client, _ := docker.NewClient(SOCKET)
return client.ListImages(options)
}
func listContainers(options docker.ListContainersOptions) ([]docker.APIContainers, error) {
client, _ := docker.NewClient(SOCKET)
return client.ListContainers(options)
}
func createContainer(opts docker.CreateContainerOptions) (*docker.Container, error) {
client, _ := docker.NewClient(SOCKET)
return client.CreateContainer(opts)
}
func startContainer(id string, config *docker.HostConfig) error {
client, _ := docker.NewClient(SOCKET)
return client.StartContainer(id, config)
}
func stopContainer(id string) error {
client, _ := docker.NewClient(SOCKET)
return client.StopContainer(id, 15)
}
func removeContainer(opts docker.RemoveContainerOptions) error {
client, _ := docker.NewClient(SOCKET)
return client.RemoveContainer(opts)
}
func inspectContainer(id string) (*docker.Container, error) {
client, _ := docker.NewClient(SOCKET)
return client.InspectContainer(id)
}