예제 #1
0
// Build a container
func Build(docker dockerclient.Client, repoName string, context string) {
	// Build a docker image
	// some.tar contains the build context (Dockerfile any any files it needs to add/copy)
	dockerBuildContext, err := os.Open(context)
	defer dockerBuildContext.Close()

	buildImageConfig := &dockerclient.BuildImage{
		Context:        dockerBuildContext,
		RepoName:       repoName,
		SuppressOutput: false,
	}
	reader, err := docker.BuildImage(buildImageConfig)
	if err != nil {
		log.Fatal(err)
	}
	log.Print(reader)
}