Optimize the bash completion even further

The biggest/bestest change here is cutting down on the number of calls to Docker in the filtering helpers (`__docker_containers_running`, etc), especially calls to the really heavy `docker images`.

I also updated some bits of the script to use a more consistent style (especially to be more consistent with the scripts in the rest of the repo).

cc @jfrazelle 

Closes #8359