Docker by Example

  • Docker Bash Completion
  • Running Containers
  • Using Docker Images
  • Writing Dockerfiles and Best Practices
  • Multi-Stage Builds
  • Docker Registry
  • Using Networks and Ports
  • Docker Volumes
  • Accessing Docker Host Remotely over TLS
  • Managing Docker Containers with Terraform
  • Important Docker Daemon Config Options
  • Garbage Collection of Unused Objects
  • Frequently Used Commands, the New and the Old
  • Public Registry Services
  • Docker Store and Certified Images
  • Docker Trusted Registry ( DTR )
  • Signing Docker Images
  • Automating the Docker Image Signing
  • CI/CD example with Docker and Gitlab

Docker Bash Completion

Once you have installed Docker , by using one of the available options for your environment , the next thing you would like to do is to enable bash completion for docker command , so that you don’t have to type a lot. Same is true for other tools like kubectl and git.

But before installing any bash completion script for any of your tools , you need to install bash completion package on your system:

### On MAC:

$ brew install bash-completion
$ brew tap homebrew/completions

### On RHEL

yum install bash-completion

### On Debian/Ubuntu

apt-get install bash-completion

Follow this guide for detailed instructions:

In short , you need to be able to install bash completion first on your system , and then install bash completion for other tools on top of that. If you just google it , you will find bash completions for almost all your favourite command line tools. I personally consider it as a requirement before doing anything with that particular command line tool , to install its bash completion if its available.

After settting up bash completion , you should be able to complete commands by just pressing tabs:

C02W84XMHTD5:~ iahmad$ docker <tabe tab >
attach      create      history     load        plugin      rm          stack       top         
build       deploy      image       login       port        rmi         start       trust       
checkpoint  diff        images      logout      ps          run         stats       unpause     
commit      events      import      logs        pull        save        stop        update      

C02W84XMHTD5:~ iahmad$ docker node < tab tab >
demote   inspect  ls       promote  ps       rm       update   

C02W84XMHTD5:~ iahmad$ docker system < tab tab >
df      events  info    prune   

Leave a comment

Your email address will not be published. Required fields are marked *