Clarify behaviour of rm and down

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
Aanand Prasad 2016-04-11 14:26:45 +01:00
parent 97467c7dec
commit 3722bb38c6
3 changed files with 47 additions and 25 deletions

View File

@ -264,18 +264,29 @@ class TopLevelCommand(object):
def down(self, options): def down(self, options):
""" """
Stop containers and remove containers, networks, volumes, and images Stops containers and removes containers, networks, volumes, and images
created by `up`. Only containers and networks are removed by default. created by `up`.
By default, the only things removed are:
- Containers for services defined in the Compose file
- Networks defined in the `networks` section of the Compose file
- The default network, if one is used
Networks and volumes defined as `external` are never removed.
Usage: down [options] Usage: down [options]
Options: Options:
--rmi type Remove images, type may be one of: 'all' to remove --rmi type Remove images. Type must be one of:
all images, or 'local' to remove only images that 'all': Remove all images used by any service.
don't have an custom name set by the `image` field 'local': Remove only images that don't have a custom tag
-v, --volumes Remove data volumes set by the `image` field.
--remove-orphans Remove containers for services not defined in -v, --volumes Remove named volumes declared in the `volumes` section
the Compose file of the Compose file and anonymous volumes
attached to containers.
--remove-orphans Remove containers for services not defined in the
Compose file
""" """
image_type = image_type_from_opt('--rmi', options['--rmi']) image_type = image_type_from_opt('--rmi', options['--rmi'])
self.project.down(image_type, options['--volumes'], options['--remove-orphans']) self.project.down(image_type, options['--volumes'], options['--remove-orphans'])
@ -496,10 +507,10 @@ class TopLevelCommand(object):
def rm(self, options): def rm(self, options):
""" """
Remove stopped service containers. Removes stopped service containers.
By default, volumes attached to containers will not be removed. You can see all By default, anonymous volumes attached to containers will not be removed. You
volumes with `docker volume ls`. can override this with `-v`. To list all volumes, use `docker volume ls`.
Any data which is not in a volume will be lost. Any data which is not in a volume will be lost.
@ -507,7 +518,7 @@ class TopLevelCommand(object):
Options: Options:
-f, --force Don't ask to confirm removal -f, --force Don't ask to confirm removal
-v Remove volumes associated with containers -v Remove any anonymous volumes attached to containers
-a, --all Also remove one-off containers created by -a, --all Also remove one-off containers created by
docker-compose run docker-compose run
""" """

View File

@ -12,17 +12,27 @@ parent = "smn_compose_cli"
# down # down
``` ```
Stop containers and remove containers, networks, volumes, and images
created by `up`. Only containers and networks are removed by default.
Usage: down [options] Usage: down [options]
Options: Options:
--rmi type Remove images, type may be one of: 'all' to remove --rmi type Remove images. Type must be one of:
all images, or 'local' to remove only images that 'all': Remove all images used by any service.
don't have an custom name set by the `image` field 'local': Remove only images that don't have a custom tag
-v, --volumes Remove data volumes set by the `image` field.
-v, --volumes Remove named volumes declared in the `volumes` section
of the Compose file and anonymous volumes
attached to containers.
--remove-orphans Remove containers for services not defined in the --remove-orphans Remove containers for services not defined in the
Compose file Compose file
``` ```
Stops containers and removes containers, networks, volumes, and images
created by `up`.
By default, the only things removed are:
- Containers for services defined in the Compose file
- Networks defined in the `networks` section of the Compose file
- The default network, if one is used
Networks and volumes defined as `external` are never removed.

View File

@ -16,13 +16,14 @@ Usage: rm [options] [SERVICE...]
Options: Options:
-f, --force Don't ask to confirm removal -f, --force Don't ask to confirm removal
-v Remove volumes associated with containers -v Remove any anonymous volumes attached to containers
-a, --all Also remove one-off containers -a, --all Also remove one-off containers created by
docker-compose run
``` ```
Removes stopped service containers. Removes stopped service containers.
By default, volumes attached to containers will not be removed. You can see all By default, anonymous volumes attached to containers will not be removed. You
volumes with `docker volume ls`. can override this with `-v`. To list all volumes, use `docker volume ls`.
Any data which is not in a volume will be lost. Any data which is not in a volume will be lost.