本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}