本文整理汇总了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
}