Exists returns true if the specicifed image exists in the local containers storage. Note that it may return false if an image corrupted.
(name string)
| 151 | // Exists returns true if the specicifed image exists in the local containers |
| 152 | // storage. Note that it may return false if an image corrupted. |
| 153 | func (r *Runtime) Exists(name string) (bool, error) { |
| 154 | image, _, err := r.LookupImage(name, nil) |
| 155 | if err != nil && errors.Cause(err) != storage.ErrImageUnknown { |
| 156 | return false, err |
| 157 | } |
| 158 | if image == nil { |
| 159 | return false, nil |
| 160 | } |
| 161 | if err := image.isCorrupted(name); err != nil { |
| 162 | logrus.Error(err) |
| 163 | return false, nil |
| 164 | } |
| 165 | return true, nil |
| 166 | } |
| 167 | |
| 168 | // LookupImageOptions allow for customizing local image lookups. |
| 169 | type LookupImageOptions struct { |