Re: A Simple Docker Shortcut

Published on at techie , 2 mins.

Thanks for sharing the snippet, Dominique. I have something similar but extended to report a few more details from my computer’s Docker assets, passed by a workmate some time ago:

$ cat .local/bin/docker-report

set -e

echo -e "Images\n======================"
docker image list --all --format "table {{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}\t{{.VirtualSize}}"

echo -e "\nContainers\n======================"
docker container list --all --format "table {{.ID}}\t{{.Names}}\t{{.RunningFor}}\t{{.Status}}"

echo -e "\nVolumes\n======================"
docker volume list

echo -e "\nNetworks\n======================"
docker network list

Apart from this I have many other Docker aliases on my system, mostly coming from the oh-my-zsh docker plugin. I only use a bunch of them on a day to day basis, though, because who has the brain to remember all those aliases? xD

$ alias | grep docker       
dbl='docker build'
dc='docker compose'
dcb='docker compose build'
dcdn='docker compose down'
dce='docker compose exec'
dcin='docker container inspect'
dck='docker compose kill'
dcl='docker compose logs'
dclF='docker compose logs -f --tail 0'
dclf='docker compose logs -f'
dcls='docker container ls'
dclsa='docker container ls -a'
dco='docker container'
dcola='docker container list --all'
dcps='docker compose ps'
dcpull='docker compose pull'
dcr='docker compose run'
dcrestart='docker compose restart'
dcrm='docker compose rm'
dcstart='docker compose start'
dcstop='docker compose stop'
dcup='docker compose up'
dcupb='docker compose up --build'
dcupd='docker compose up -d'
dcupdb='docker compose up -d --build'
dib='docker image build'
dii='docker image inspect'
dils='docker image ls'
dipu='docker image push'
dirm='docker image rm'
dit='docker image tag'
dlo='docker container logs'
dls='docker ps -a --format '\''table {{.ID}}\t{{.Names}}\t{{.RunningFor}}\t{{.Status}}\t{{.Networks}}'\'
dnc='docker network create'
dncn='docker network connect'
dndcn='docker network disconnect'
dni='docker network inspect'
dnls='docker network ls'
dnrm='docker network rm'
dpo='docker container port'
dpu='docker pull'
dr='docker container run'
drit='docker container run -it'
drm='docker container rm'
'drm!'='docker container rm -f'
drs='docker container restart'
dst='docker container start'
dsta='docker stop $(docker ps -q)'
dstp='docker container stop'
dtop='docker top'
dvi='docker volume inspect'
dvls='docker volume ls'
dvprune='docker volume prune'
dxc='docker container exec'
dxcit='docker container exec -it'