My Docker shortcuts: d-

less than 1 minute read

I have created some shortcuts on Linux/MacOSX to save me some keystrokes when working with Docker:

  • alias d-rmdi=’docker images -f dangling=true -q xargs docker rmi’
  • alias d-stopall=’docker ps -q xargs docker stop’
  • alias d-rmall=’docker ps -qa xargs docker rm’
  • alias d-names=’docker ps –format “{{.Names}}”‘
  • alias d-images=’docker images –format “{{.Repository}}”‘
  • function d-bash() { docker ps -a grep $1 awk ‘{print “docker exec -it ” $1 ” bash”;exit;}’ ; }

The last one is a function, need to put it in a pair of grave accents to really run it, like: `d-bash myapp`

Categories: Tech

Updated: