Skip to content

Instantly share code, notes, and snippets.

@gullitmiranda
Last active May 11, 2016 02:35
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gullitmiranda/d5e322cdf473a8dddf14 to your computer and use it in GitHub Desktop.
Save gullitmiranda/d5e322cdf473a8dddf14 to your computer and use it in GitHub Desktop.
Clean Docker images and containers cheat sheet.

Docker Cheat Sheet

NOTE: if you are using the docker without the http://azk.io installed, use docker instead of adocker.

Kill running containers

adocker kill $(adocker ps -q | tr '\r\n' ' ')

Delete stopped containers

adocker rm -f $(adocker ps -f status=exited -q | tr '\r\n' ' ')

Remove images (using a filter)

In this example the filter is azkbuild:

adocker rmi $(adocker images | grep "azkbuild" | awk '{print $3}' | tr '\r\n' ' ')

Deleting untagged images

adocker rmi $(adocker images -q -f dangling=true | tr '\r\n' ' ')
NOTES:
  • Join lines:

    tr '\r\n' ' '

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment