本文整理匯總了Golang中github.com/openshift/source-to-image/pkg/docker.Docker類的典型用法代碼示例。如果您正苦於以下問題:Golang Docker類的具體用法?Golang Docker怎麽用?Golang Docker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Docker類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createLabelsForResultingImage
func createLabelsForResultingImage(builder *STI, docker dockerpkg.Docker, baseImage string) map[string]string {
generatedLabels := util.GenerateOutputImageLabels(builder.sourceInfo, builder.config)
existingLabels, err := docker.GetLabels(baseImage)
if err != nil {
glog.V(0).Infof("error: Unable to read existing labels from the base image %s", baseImage)
}
return mergeLabels(generatedLabels, existingLabels)
}
示例2: commitContainer
func commitContainer(docker dockerpkg.Docker, containerID, cmd, user, tag string, env, entrypoint []string, labels map[string]string) (string, error) {
opts := dockerpkg.CommitContainerOptions{
Command: []string{cmd},
Env: env,
Entrypoint: entrypoint,
ContainerID: containerID,
Repository: tag,
User: user,
Labels: labels,
}
imageID, err := docker.CommitContainer(opts)
if err != nil {
return "", s2ierr.NewCommitError(tag, err)
}
return imageID, nil
}
示例3: checkAllowedUser
func checkAllowedUser(d docker.Docker, config *api.Config, isOnbuild bool) error {
if config.AllowedUIDs == nil || config.AllowedUIDs.Empty() {
return nil
}
user, err := d.GetImageUser(config.BuilderImage)
if err != nil {
return err
}
if !userutil.IsUserAllowed(user, &config.AllowedUIDs) {
return errors.NewBuilderUserNotAllowedError(config.BuilderImage, false)
}
if isOnbuild {
cmds, err := d.GetOnBuild(config.BuilderImage)
if err != nil {
return err
}
if !userutil.IsOnbuildAllowed(cmds, &config.AllowedUIDs) {
return errors.NewBuilderUserNotAllowedError(config.BuilderImage, true)
}
}
return nil
}