mirror of https://github.com/docker/compose.git
support dry-run for rm command
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
78b9404767
commit
eb1c798912
|
@ -79,5 +79,6 @@ func runRemove(ctx context.Context, backend api.Service, opts removeOptions, ser
|
|||
Force: opts.force,
|
||||
Volumes: opts.volumes,
|
||||
Project: project,
|
||||
Stop: opts.stop,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -229,8 +229,8 @@ type KillOptions struct {
|
|||
type RemoveOptions struct {
|
||||
// Project is the compose project used to define this app. Might be nil if user ran command just with project name
|
||||
Project *types.Project
|
||||
// DryRun just list removable resources
|
||||
DryRun bool
|
||||
// Stop option passed in the command line
|
||||
Stop bool
|
||||
// Volumes remove anonymous volumes
|
||||
Volumes bool
|
||||
// Force don't ask to confirm removal
|
||||
|
|
|
@ -77,7 +77,7 @@ func (d *DryRunClient) ContainerPause(ctx context.Context, container string) err
|
|||
}
|
||||
|
||||
func (d *DryRunClient) ContainerRemove(ctx context.Context, container string, options moby.ContainerRemoveOptions) error {
|
||||
return ErrNotImplemented
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DryRunClient) ContainerRename(ctx context.Context, container, newContainerName string) error {
|
||||
|
|
|
@ -45,7 +45,7 @@ func (s *composeService) Remove(ctx context.Context, projectName string, options
|
|||
}
|
||||
|
||||
stoppedContainers := containers.filter(func(c moby.Container) bool {
|
||||
return c.State != ContainerRunning
|
||||
return c.State != ContainerRunning || (options.Stop && s.dryRun)
|
||||
})
|
||||
|
||||
var names []string
|
||||
|
|
Loading…
Reference in New Issue