Getting Docker Tab Completion on PowerShell

Using the wonderful DockerCompletion PowerShell module.

Before you start, please consider that at the time of writing, this tool requires using PowerShell 5.0 or greater, and having docker CLI version 1.13 or greater in your PATH environment variable.

Open a PS session and run -

Install-Module DockerCompletion -Scope CurrentUser

This will install the DockerCompletion and make it available for use. Once installed, the module can be loaded with the command Import-Module DockerCompletion , but seeing as we don’t want to manually execute this command every time we start a PS session, we still need to make sure it is gets loaded automatically every time.

To do this, run these command -

echo "" >> $PROFILE  # ensure newline at the end of the file
echo "Import-Module DockerCompletion" >> $PROFILE

This will add the command to load the DockerCompletion module to the end of you PowerShell profile file. This file is a PowerShell script that is executed at the start of every new PS session, similarly to how the .bashrc file is executed by bash on Linux. This means that by using this file to load DockerCompletion, we insure the module is always loaded when we open a PS terminal.

You should now be able to open a new PS session and have tab completion for docker 💪