当前位置: 首页>>代码示例>>Golang>>正文


Golang errors.NewInspectImageError函数代码示例

本文整理汇总了Golang中github.com/openshift/source-to-image/pkg/errors.NewInspectImageError函数的典型用法代码示例。如果您正苦于以下问题:Golang NewInspectImageError函数的具体用法?Golang NewInspectImageError怎么用?Golang NewInspectImageError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewInspectImageError函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: CheckImage

// CheckImage checks image from the local registry.
func (d *stiDocker) CheckImage(name string) (*docker.Image, error) {
	name = getImageName(name)
	image, err := d.client.InspectImage(name)
	if err != nil {
		return nil, errors.NewInspectImageError(name, err)
	}
	return image, nil
}
开发者ID:jhadvig,项目名称:origin,代码行数:9,代码来源:docker.go

示例2: CheckImage

// CheckImage checks image from the local registry.
func (d *stiDocker) CheckImage(name string) (*docker.Image, error) {
	name = getImageName(name)
	image, err := d.client.InspectImage(name)
	if err != nil {
		glog.V(4).Infof("error inspecting image %s: %v", name, err)
		return nil, errors.NewInspectImageError(name, err)
	}
	return image, nil
}
开发者ID:johnmccawley,项目名称:origin,代码行数:10,代码来源:docker.go

示例3: GetLabels

// GetLabels retrieves the labels of the given image.
func (d *stiDocker) GetLabels(name string) (map[string]string, error) {
	name = getImageName(name)
	resp, err := d.InspectImage(name)
	if err != nil {
		glog.V(4).Infof("error inspecting image %s: %v", name, err)
		return nil, errors.NewInspectImageError(name, err)
	}
	return resp.Config.Labels, nil
}
开发者ID:php-coder,项目名称:source-to-image,代码行数:10,代码来源:docker.go

示例4: GetLabels

// GetLabels retrieves the labels of the given image.
func (d *stiDocker) GetLabels(name string) (map[string]string, error) {
	name = getImageName(name)
	image, err := d.client.InspectImage(name)
	if err != nil {
		return nil, errors.NewInspectImageError(name, err)
	}
	return image.Config.Labels, nil

}
开发者ID:urashidmalik,项目名称:origin,代码行数:10,代码来源:docker.go

示例5: GetOnBuild

// GetOnBuild returns the set of ONBUILD Dockerfile commands to execute
// for the given image
func (d *stiDocker) GetOnBuild(name string) ([]string, error) {
	name = getImageName(name)
	resp, err := d.InspectImage(name)
	if err != nil {
		glog.V(4).Infof("error inspecting image %s: %v", name, err)
		return nil, s2ierr.NewInspectImageError(name, err)
	}
	return resp.Config.OnBuild, nil
}
开发者ID:xgwang-zte,项目名称:origin,代码行数:11,代码来源:docker.go

示例6: IsImageInLocalRegistry

// IsImageInLocalRegistry determines whether the supplied image is in the local registry.
func (d *stiDocker) IsImageInLocalRegistry(name string) (bool, error) {
	name = getImageName(name)
	resp, err := d.InspectImage(name)
	if resp != nil {
		return true, nil
	}
	if err != nil && !dockerapi.IsErrImageNotFound(err) {
		return false, errors.NewInspectImageError(name, err)
	}
	return false, nil
}
开发者ID:php-coder,项目名称:source-to-image,代码行数:12,代码来源:docker.go

示例7: GetImageUser

// GetImageUser finds and retrieves the user associated with
// an image if one has been specified
func (d *stiDocker) GetImageUser(name string) (string, error) {
	name = getImageName(name)
	image, err := d.client.InspectImage(name)
	if err != nil {
		return "", errors.NewInspectImageError(name, err)
	}
	user := image.ContainerConfig.User
	if len(user) == 0 {
		user = image.Config.User
	}
	return user, nil
}
开发者ID:jhadvig,项目名称:origin,代码行数:14,代码来源:docker.go

示例8: CheckAndPull

// CheckAndPull pulls an image into the local registry if not present
// and returns the image metadata
func (d *stiDocker) CheckAndPull(name string) (image *docker.Image, err error) {
	name = getImageName(name)
	if image, err = d.client.InspectImage(name); err != nil && err != docker.ErrNoSuchImage {
		return nil, errors.NewInspectImageError(name, err)
	}
	if image == nil {
		return d.PullImage(name)
	}

	glog.V(2).Infof("Image %s available locally", name)
	return
}
开发者ID:yarko,项目名称:source-to-image,代码行数:14,代码来源:docker.go

示例9: PullImage

// PullImage pulls an image into the local registry
func (d *stiDocker) PullImage(name string) (image *docker.Image, err error) {
	name = getImageName(name)
	glog.V(1).Infof("Pulling image %s", name)
	// TODO: Add authentication support
	if err = d.client.PullImage(docker.PullImageOptions{Repository: name}, d.pullAuth); err != nil {
		glog.V(3).Infof("An error was received from the PullImage call: %v", err)
		return nil, errors.NewPullImageError(name, err)
	}
	if image, err = d.client.InspectImage(name); err != nil {
		return nil, errors.NewInspectImageError(name, err)
	}
	return
}
开发者ID:yarko,项目名称:source-to-image,代码行数:14,代码来源:docker.go

示例10: GetImageUser

// GetImageUser finds and retrieves the user associated with
// an image if one has been specified
func (d *stiDocker) GetImageUser(name string) (string, error) {
	name = getImageName(name)
	resp, err := d.InspectImage(name)
	if err != nil {
		glog.V(4).Infof("error inspecting image %s: %v", name, err)
		return "", errors.NewInspectImageError(name, err)
	}
	user := resp.ContainerConfig.User
	if len(user) == 0 {
		user = resp.Config.User
	}
	return user, nil
}
开发者ID:php-coder,项目名称:source-to-image,代码行数:15,代码来源:docker.go

示例11: CheckImage

// CheckImage checks image from the local registry.
func (d *stiDocker) CheckImage(name string) (*api.Image, error) {
	name = getImageName(name)
	inspect, err := d.InspectImage(name)
	if err != nil {
		glog.V(4).Infof("error inspecting image %s: %v", name, err)
		return nil, errors.NewInspectImageError(name, err)
	}
	if inspect != nil {
		image := &api.Image{}
		updateImageWithInspect(image, inspect)
		return image, nil
	}

	return nil, nil
}
开发者ID:php-coder,项目名称:source-to-image,代码行数:16,代码来源:docker.go


注:本文中的github.com/openshift/source-to-image/pkg/errors.NewInspectImageError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。