Add command to remove application images #648
Conversation
internal/store/bundle.go
Outdated
@@ -97,6 +98,20 @@ func (b *bundleStore) List() ([]reference.Named, error) { | |||
return references, nil | |||
} | |||
|
|||
// Remove removes a bundle from the bundle store. | |||
func (b *bundleStore) Remove(ref reference.Named) error { | |||
if _, err := b.Read(ref); err != nil { |
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.
What about using os.Stat(path)
instead?
Codecov Report
@@ Coverage Diff @@
## master #648 +/- ##
========================================
Coverage ? 71.8%
========================================
Files ? 52
Lines ? 2713
Branches ? 0
========================================
Hits ? 1948
Misses ? 513
Partials ? 252
Continue to review full report at Codecov.
|
6182b38
to
e3314e4
Compare
e3314e4
to
8fc319c
Compare
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
8fc319c
to
3385987
Compare
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.
LGTM
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.
LGTM
|
||
func rmCmd() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "rm [APP_IMAGE] [APP_IMAGE...]", |
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.
Sorry for the late reply, but could you add remove
as alias for this?
Use: "rm [APP_IMAGE] [APP_IMAGE...]", | |
Use: "rm [APP_IMAGE] [APP_IMAGE...]", | |
Aliases: []string{"remove"}, |
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.
Actually, let me open a quick PR
return err | ||
} | ||
|
||
fmt.Println("Deleted: " + ref.String()) |
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.
Perhaps we should consistently use dockerCli.Out()
/ dockerCli.Err()
for these; ideally we would print the reference on stdout, and Deleted:
on stderr, but I don't think we do that currently on the CLI
- What I did
Added a new comand to remove application images, example:
- How I did it
The
image rm
command only remove the bundle from the bundle store, container images are not touched- How to verify it
Look at the e2e test to see sample usage.
- Description for the changelog
New subcommand
docker app image rm
to remove a docker application from the local bundle store.- A picture of a cute animal (not mandatory but encouraged)