Skip to content

Instantly share code, notes, and snippets.

@dmitrinesterenko
Last active December 5, 2015 23:19
Show Gist options
  • Save dmitrinesterenko/ba3c6491fdc7bcc9b6d2 to your computer and use it in GitHub Desktop.
Save dmitrinesterenko/ba3c6491fdc7bcc9b6d2 to your computer and use it in GitHub Desktop.
Docker Kill Old Containers
> docker ps -q # will print all existing containers in reverse chronological order.
# Pick one after which you want to remove all containers and use it in the next command.
385cebfa43b2
af769cf18cef
2ba61ccb9327
c082932195b3
> docker rm $(docker ps -aq --before=c082932195b3) # where the before container ID is the container after which you want to delete the rest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment