Initial commit - exported from wordpress
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
---
|
||||
author: mikeconrad
|
||||
categories:
|
||||
- Automation
|
||||
- Docker
|
||||
- Software Engineering
|
||||
date: "2024-04-03T09:12:41Z"
|
||||
guid: https://hackanooga.com/?p=557
|
||||
id: 557
|
||||
image: /wp-content/uploads/2024/04/docker-logo-blue-min.png
|
||||
tags:
|
||||
- Blog Post
|
||||
title: Stop all running containers with Docker
|
||||
url: /stop-all-running-containers-with-docker/
|
||||
---
|
||||
|
||||
These are some handy snippets I use on a regular basis when managing containers. I have one server in particular that can sometimes end up with 50 to 100 orphaned containers for various reasons. The easiest/quickest way to stop all of them is to do something like this:
|
||||
|
||||
```
|
||||
docker container stop $(docker container ps -q)
|
||||
```
|
||||
|
||||
Let me break this down in case you are not familiar with the syntax. Basically we are passing the output of `docker container ps -q` into docker container stop. This works because the stop command can take a list of container ids which is what we get when passing the `-q` flag to docker container ps.
|
Reference in New Issue
Block a user