Working with Docker using the docker cli commands is extremely productive and fast – provided you know most of the commands by heart. Soon into your Docker journey you’ll memorise some of the most useful commands very quickly and keep using these, for example docker ps or docker images and so on… right?
Quickly after that, you’ll be sitting in front of your screen and thinking – how can I reduce the typing? or I wish I could just type one short-hand command to do xyz operation….
Some of you will use the CMD/Bash history (arrow up/down) to efficiently navigate between most recently used commands – well – until you have so many of these that you get lost "in the history"…
Problem Statement
If only I could have short-hand scripts to help reduce typing some of the most repetitive docker cli commands.
qbitcli to the rescue…
What is "qbitcli"?
qbitcli is a bundle full of useful scripts, covering the following technologies: Azure, Docker, Kubernetes and Helm Charts.
All resources in qbitcli are free, public and constantly updated with new code snippets.
How to use "qbitcli" with Docker
Step 1 – Deploy "qbitcli"
Open CMD, navigate to location where you need the qbitcli resources copied and run the command below. Image always has latest tag and it’s the only tag.
docker create --name qbitcli qbituniverse/qbitcli
docker cp qbitcli:/qbitcli/. qbitcli/
docker rm -fv qbitcli
docker rmi -f qbituniverse/qbitcli:latest
The end result will be a folder structure created as follows:
|- qbitcli
|- docker.ps1
|- ...
Step 2 – View all Docker resources with "qbitcli"
docker.ps1
Step 3 – Discover more "qbitcli" Flags for Docker
docker.ps1 --help
Flags
–view | View all Docker resources. Same as typing docker.ps1 on its own. |
–pd | Prune dangling volumes & images. |
–pu | Prune unused volumes & images. |
–pc | Prune containers. |
–pa | Prune entire system. |
Usage
Short-hand to view all resources
docker.ps1
Use with a flag
docker.ps1 [flag]