Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clean Docker images and containers cheat sheet.

Docker Cheat Sheet

NOTE: if you are using the docker without the 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' ' ')
  • Join lines:

    tr '\r\n' ' '


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.