Skip to content

Instantly share code, notes, and snippets.

@muresan
Created September 28, 2017 08:51
Show Gist options
  • Save muresan/ee287e3acb332b8ee94e764d7c0c6fcc to your computer and use it in GitHub Desktop.
Save muresan/ee287e3acb332b8ee94e764d7c0c6fcc to your computer and use it in GitHub Desktop.
# format table
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
# filter
# until (<timestamp>) - only remove containers created before given timestamp
# label (label=<key>, label=<key>=<value>, label!=<key>, or label!=<key>=<value>)
# - only remove containers with (or without, in case label!=... is used) the specified labels.
$ docker run -ti -l keep=yes -d alpine sleep 1h
$ docker container prune --filter='label!=keep=yes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment