Commandes Linux : docker-compose rm

DOCKER-COMPOSE RM

Commande : docker-compose rm
Removes stopped service containers.

By default, anonymous volumes attached to containers will not be removed. You
can override this with `-v`. To list all volumes, use `docker volume ls`.

Any data which is not in a volume will be lost.

Usage: rm [options] [SERVICE...]

Options:
    -f, --force   Don't ask to confirm removal
    -s, --stop    Stop the containers, if required, before removing
    -v            Remove any anonymous volumes attached to containers
    -a, --all     Deprecated - no effect.

 

Supprimer les containers stoppés au préalable :

Si aucun service n’est spécifié, tous les containers stoppés de l’application seront supprimés.

docker-compose rm [SERVICE...]

ex :

$ docker-compose rm
Going to remove example-voting-app_worker_1, redis, db, example-voting-app_result_1, example-voting-app_vote_1
Are you sure? [yN] y
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

 

Stopper et supprimer les containers :

Si aucun service n’est spécifié, tous les containers de l’application seront stoppés puis supprimés.

docker-compose rm -s [SERVICE...]

ex :

$ docker-compose rm -s
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
Going to remove example-voting-app_worker_1, redis, db, example-voting-app_result_1, example-voting-app_vote_1
Are you sure? [yN] y
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
$ docker-compose rm -s vote
Stopping example-voting-app_vote_1 ... done
Going to remove example-voting-app_vote_1
Are you sure? [yN] y
Removing example-voting-app_vote_1 ... done

 

Fermer le menu