Docker comes with command completion for the bash and zsh shell.
Here is the procedure to enable bash auto completion in Docker CE on Centos 7 and Ubuntu
Install bash-completion package
on CentOS/RedHat
# yum -y install bash-completion
on Ubuntu
apt-get install bash-completion
Download bash completion file into /etc/bash_completion.d
# curl https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker -o /etc/bash_completion.d/docker.sh
Logout and login again.
When I type docker im and enter TAB then, I will get the possible parameters
# docker im<TAB>
image images import
If I type docker images then TAB, docker will list the available images.
# docker images <TAB>
nginx:latest redis
It alo shows us the parameter of each command
# docker ps -<TAB>
-a -f --format -l --latest --no-trunc --quiet --size
--all --filter --help --last -n -q -s
İsmail Yenigül
Linux & AWS Certified Cloud Expert