Add Inspect image#239
Conversation
bfa9d38 to
4d8a1c7
Compare
| // Not compatible with `docker image inspect`. | ||
| type Image struct { | ||
| images.Image | ||
| ImageSpec interface{} `json:"Image"` |
There was a problem hiding this comment.
@AkihiroSuda interface{}. because i want to avoid using the ocispec.Image in this native containerd object
There was a problem hiding this comment.
Why do you want to avoid it?
There was a problem hiding this comment.
it looks cleaner if i use an interface here and map this interface to ocispec.Image in dockercompat may be I'm wrong. Anyway I made the change
| defaultBashComplete(clicontext) | ||
| return | ||
| } | ||
| // show container names |
| } | ||
|
|
||
| if ni != 0 && nc != 0 { | ||
| return errors.Errorf("Multiple IDs found with provided prefix: %s", req) |
There was a problem hiding this comment.
error should start with a lower char
|
|
||
| i.ID = n.Descriptor.Digest.String() | ||
|
|
||
| s := []string{n.Image.Name, "@", n.Image.Target.Digest.String()} |
| i.ID = n.Descriptor.Digest.String() | ||
|
|
||
| s := []string{n.Image.Name, "@", n.Image.Target.Digest.String()} | ||
| i.RepoTags, i.RepoDigests = parseImageReferences([]string{strings.Join(s, "")}) |
There was a problem hiding this comment.
We already know the digest, no need to "parse" it
| } | ||
|
|
||
| n.Descriptor = config | ||
| n.Image.Name = image.Name |
There was a problem hiding this comment.
Why not just set n.Image = image
b53f984 to
5e4b918
Compare
| } | ||
|
|
||
| var tag string | ||
| nameWithTagSplit := strings.Split(imgName, ":") |
There was a problem hiding this comment.
There was a problem hiding this comment.
(I noticed that the code is not new in this PR, so this can be done later)
| } | ||
| repository := strings.TrimSuffix(imgName, ":"+tag) | ||
| repository = strings.TrimPrefix(repository, "docker.io/library/") | ||
| repository = strings.TrimPrefix(repository, "docker.io/") |
There was a problem hiding this comment.
There was a problem hiding this comment.
same for this, this will be done in new PR!
|
As usual, please squash commits |
dc52fd7 to
be8d9a0
Compare
Signed-off-by: fahed dorgaa <[email protected]>
|
Added commit bcd29a7 |
Signed-off-by: Akihiro Suda <[email protected]>
ba1dfc0 to
bcd29a7
Compare
same as
docker image inspectanddocker inspectrelated ticket #222