當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。