Commandes Linux : docker-compose down

DOCKER-COMPOSE DOWN

Commande : docker-compose down
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.

Usage: down [options]

Options:
    --rmi type              Remove images. Type must be one of:
                              'all': Remove all images used by any service.
                              'local': Remove only images that don't have a
                              custom tag 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
                            Compose file
    -t, --timeout TIMEOUT   Specify a shutdown timeout in seconds.
                            (default: 10)

 

Arrêter les services, supprimer les containers et les réseaux de l’application :

Contrairement à la commande docker-compose stop, les containers seront non seulement arrêtés mais également supprimés.
Les réseaux définis dans le fichier docker-compose.yml seront également supprimés.

docker-compose down

ex :

$ docker-compose down
Stopping db                          ... done
Stopping example-voting-app_result_1 ... done
Stopping example-voting-app_vote_1   ... done
Stopping example-voting-app_worker_1 ... done
Stopping redis                       ... done
Removing db                          ... done
Removing example-voting-app_result_1 ... done
Removing example-voting-app_vote_1   ... done
Removing example-voting-app_worker_1 ... done
Removing redis                       ... done
Removing network example-voting-app_front-tier
Removing network example-voting-app_back-tier
$ docker-compose -f compose-sample-3/docker-compose.yml down

 

Arrêter les services, supprimer les containers, les réseaux et les volumes :

docker-compose down --volumes

ex :

$ docker-compose down --volumes
Stopping example-voting-app_worker_1 ... done
Stopping redis                       ... done
Stopping db                          ... done
Stopping example-voting-app_result_1 ... done
Stopping example-voting-app_vote_1   ... done
Removing example-voting-app_worker_1 ... done
Removing redis                       ... done
Removing db                          ... done
Removing example-voting-app_result_1 ... done
Removing example-voting-app_vote_1   ... done
Removing network example-voting-app_front-tier
Removing network example-voting-app_back-tier
Removing volume example-voting-app_db-data

 

Arrêter les services, supprimer les containers, les réseaux, les volumes et les images construites et téléchargées :

docker-compose down --volumes --rmi all

ex :

$ docker-compose down --volumes --rmi all
Stopping example-voting-app_worker_1 ... done
Stopping example-voting-app_result_1 ... done
Stopping redis                       ... done
Stopping example-voting-app_vote_1   ... done
Stopping db                          ... done
Removing example-voting-app_worker_1 ... done
Removing example-voting-app_result_1 ... done
Removing redis                       ... done
Removing example-voting-app_vote_1   ... done
Removing db                          ... done
Removing network example-voting-app_front-tier
Removing network example-voting-app_back-tier
Removing volume example-voting-app_db-data
Removing image example-voting-app_vote
Removing image example-voting-app_result
Removing image redis:alpine
Removing image example-voting-app_worker
Removing image postgres:9.4

 

Fermer le menu