Remove stopped service containers. Delegates to `docker compose rm`. See that command's help for details. Args: services: The names of services in the composition. stop: Stop the containers if necessary. destroy_volumes: Destroy any anonymous vol
(
self, *services: str, stop: bool = True, destroy_volumes: bool = True
)
| 1560 | self.invoke("unpause", *services) |
| 1561 | |
| 1562 | def rm( |
| 1563 | self, *services: str, stop: bool = True, destroy_volumes: bool = True |
| 1564 | ) -> None: |
| 1565 | """Remove stopped service containers. |
| 1566 | |
| 1567 | Delegates to `docker compose rm`. See that command's help for details. |
| 1568 | |
| 1569 | Args: |
| 1570 | services: The names of services in the composition. |
| 1571 | stop: Stop the containers if necessary. |
| 1572 | destroy_volumes: Destroy any anonymous volumes associated with the |
| 1573 | service. Note that this does not destroy any named volumes |
| 1574 | attached to the service. |
| 1575 | """ |
| 1576 | self.capture_logs() |
| 1577 | self.invoke( |
| 1578 | "rm", |
| 1579 | "--force", |
| 1580 | *(["--stop"] if stop else []), |
| 1581 | *(["-v"] if destroy_volumes else []), |
| 1582 | *services, |
| 1583 | ) |
| 1584 | |
| 1585 | def rm_volumes(self, *volumes: str, force: bool = False) -> None: |
| 1586 | """Remove the named volumes. |