Filter Out Docker Noise

Sometimes the smallest lil' gem makes you feel great. For me, Docker's --format option is one such gem. As much as I love Docker, for me, their commands' output are far too verbose and noisy. In fact, the net is filled with complaints about this. However, the --format option makes them perfect... or closer to perfect. Even the noisiest command can be transformed...

... from this ...

Before Docker Aliases

... to this ...

After Docker Aliases

... in just a few extra keystrokes!

It outputs just the right amount of info to be particularly great for "4-up" or "2-up" arrangements...

Docker Aliases with 4 Up Display

Docker's info for the ps command completely sucks and offers no info on this option. In short, you basically use it to tell Docker what columns to display. For example, with ps you have the following columns to choose from:

  • ID
  • Image
  • Command
  • RunningFor
  • Status
  • Ports
  • Names

So, for the example above, the syntax would be:

docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Ports}}"  

Or, better yet, if you're on Linux or macOS / OSX, take a few seconds and create aliases for dps and dpsa in your ~/.bash_aliases file by adding these two lines:

alias dps='docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Ports}}"'  
alias dpsa='docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Ports}}"'  

Enjoy... finally! =)

(I've added these two aliases to my dotfiles project, if you're following that project.)