示例#1
0
func listImages(client dckr.Client, t *testing.T) []dckr.Image {
	imgs, err := client.ListImages()
	if err != nil {
		t.Error("List Image Error: ", err)
		t.Fail()
	}
	return imgs
}
示例#2
0
func buildImage(client dckr.Client, t *testing.T) dckr.Image {
	img, err := client.BuildImage("./docker_test")
	if err != nil {
		t.Error("build image failed: ", err)
		t.Fail()
	}
	log.Println("built image:", img)
	return img
}
示例#3
0
func listContainers(client dckr.Client, t *testing.T) []dckr.Container {
	containers, err := client.ListContainers()
	if err != nil {
		t.Error("list containers failed: ", err)
		t.Fail()
	}
	log.Println("list containers success: ", containers)
	return containers
}
示例#4
0
func inspectContainer(client dckr.Client, contID dckr.ContainerID, t *testing.T) dckr.Container {
	cont, err := client.InspectContainer(contID)
	if err != nil {
		t.Error("inspect container failed: ", err)
		t.Fail()
	}
	log.Println("inspect container success: ", cont)
	return cont
}
示例#5
0
func executeImage(client dckr.Client, imgid dckr.ImageID, t *testing.T) dckr.ContainerID {
	containerID, err := client.ExecuteImage(imgid, nil)
	if err != nil {
		t.Error("starting image failed: ", err)
		t.Fail()
	}
	log.Println("starting image success: ", imgid)
	return containerID
}