-
-
Save OMantere/abb1185a3f877f23213124d4df5f3444 to your computer and use it in GitHub Desktop.
Kill all running docker containers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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