-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: init pouch tag functionality #1378
feature: init pouch tag functionality #1378
Conversation
name := mux.Vars(req)["name"] | ||
|
||
targetRef := req.FormValue("repo") | ||
if tag := req.FormValue("tag"); tag != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if tag is "", do we need set default value latest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have handled it in the deamon so that we can keep the bridge simple.
@@ -60,6 +60,7 @@ func initRoute(s *Server) http.Handler { | |||
s.addRoute(r, http.MethodGet, "/images/json", s.listImages) | |||
s.addRoute(r, http.MethodDelete, "/images/{name:.*}", s.removeImage) | |||
s.addRoute(r, http.MethodGet, "/images/{name:.*}/json", s.getImage) | |||
s.addRoute(r, http.MethodPost, "/images/{name:.*}/tag", s.postImageTag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need add swagger info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Since the containerd provides the ImageService to modify the boltdb data, we can add tag reference into the containerd. Just in case that the client removes the source image. Signed-off-by: Wei Fu <[email protected]>
LGTM |
Since the containerd provides the ImageService to modify the boltdb
data, we can add tag reference into the containerd. Just in case that
the client removes the source image.
Signed-off-by: Wei Fu [email protected]
Ⅰ. Describe what this PR did
Use containerd's ImageService to implement
pouch tag
functionality. Allow user to create tag reference to existing image.Ⅱ. Does this pull request fix one issue?
NONE.
Ⅲ. Describe how you did it
The containerd stores the image name as key in the
boltdb
.pouch run/image inspect/rmi
will use the primary reference as name to handle image information.If we don't use the
boltdb
provided by containerd.ImageService, we will loss the tag reference when we remove the source image.Therefore, when user adds tag reference to the existing image, I will do the following things:
The update action will add the reference count for the image content. That is the key to implement this functionality.
Ⅳ. Describe how to verify it
First one is the help:
Use Tag:
We can use the tag reference to run container like:
But we don't allow to use
sha256
as name, because it will confuse with searching by imageID.However, it doesn't act like
docker
right now. We don't allow user to override the existing primary reference, like:Ⅴ. Special notes for reviews