Cli: [Enhancement] Provide a flag that allows me to automatically agree with docker container prune

Created on 24 Sep 2020  ·  2Comments  ·  Source: docker/cli

Description

In order to ease the pruning of containers in dev environment, it would be awesome if a -y flag can be provided. I would typically expect this flag to behave similarly with the behavior of sudo apt-get install -y command in Ubuntu.

Steps to reproduce the issue:

  1. Execute the following shell command
$ docker container prune

Describe the results you received:

$ WARNING! This will remove all images without at least one container associated to them.
$ Are you sure you want to continue? [y/N]

Describe the results you desire:

IMHO, being capable to run the following command on my dev machine really helps in improving the developer experience 👍

$ docker container prune -y

$ I removed dangling containers boss

Most helpful comment

docker container prune -f does this.

$ docker container prune --help

Usage:  docker container prune [OPTIONS]

Remove all stopped containers

Options:
      --filter filter   Provide filter values (e.g. 'until=<timestamp>')
  -f, --force           Do not prompt for confirmation

All 2 comments

docker container prune -f does this.

$ docker container prune --help

Usage:  docker container prune [OPTIONS]

Remove all stopped containers

Options:
      --filter filter   Provide filter values (e.g. 'until=<timestamp>')
  -f, --force           Do not prompt for confirmation

I hope that ‘-y’ becomes an alias of ‘-f’ because it feels confusing that the cli is asking yes or no but requires ‘-f’ as a flag 🤪🤪🤪

Was this page helpful?
0 / 5 - 0 ratings