Skip to content

Instantly share code, notes, and snippets.

@OMantere
Last active April 7, 2017 04:54
Show Gist options
  • Save OMantere/abb1185a3f877f23213124d4df5f3444 to your computer and use it in GitHub Desktop.
Save OMantere/abb1185a3f877f23213124d4df5f3444 to your computer and use it in GitHub Desktop.
Kill all running docker containers
#!/usr/bin/python
import os
import subprocess
result = subprocess.check_output('docker ps', shell=True)
for line in result.split('\n')[1:-1]:
docker_ps_id = (line.split(' ')[0])
os.system('docker kill %s' % docker_ps_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment