Merge pull request #3303 from aanand/clarify-rm-and-down
Clarify behaviour of rm and down
(cherry picked from commit 3d3f331404)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
parent
1523711e89
commit
174afeb974
3 changed files with 47 additions and 25 deletions
|
|
@ -265,18 +265,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'])
|
||||||
|
|
@ -502,10 +513,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.
|
||||||
|
|
||||||
|
|
@ -513,7 +524,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
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,15 @@ parent = "smn_compose_cli"
|
||||||
Usage: rm [options] [SERVICE...]
|
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.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue