// 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 }
// 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 }
// 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 }
// 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 }
// 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 }
// 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 }
// 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 }
// 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 }
// 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 }
// 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 }
// 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 }