Skip to content

Instantly share code, notes, and snippets.

@circa10a
Created September 15, 2018 03:13
Show Gist options
  • Save circa10a/793d76b138fdd55da9b50b3fa2859285 to your computer and use it in GitHub Desktop.
Save circa10a/793d76b138fdd55da9b50b3fa2859285 to your computer and use it in GitHub Desktop.
Kill all running docker containers via python
#!/usr/bin/env python3
import docker
client = docker.from_env()
for container in client.containers.list():
print(container.image.tags[0])
container.kill()
client.containers.list()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment