Import-Module posh-docker is not working

2.8k views Asked by At

Import-Module posh-docker is not working on Power Shell while running as administrator

Am trying to enable auto-completion of commands for the current PowerShell but getting below error. executionpolicy is already set to RemoteSigned. I have Docker Toolbox in my system.

Import-Module : The specified module 'posh-docker' was not loaded because no valid module 
 file was found directory. At line:1 char:1
+ Import-Module posh-docker
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (posh-docker:String) [Import-Module], FileNotFoundExc
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
2

There are 2 answers

0
briantist On BEST ANSWER

From your question it sounds like you're following the instructions on this page, which read:

you can install the posh-docker PowerShell Module as follows:

(emphasis mine). Their wording is incorrect; those steps are for importing the module after it has been installed.

Instructions for installing the module are on the GitHub page for posh-docker. You must follow those instructions first:

Windows 10 / Windows Server 2016

  1. Open a powershell prompt
  2. Run Install-Module -Scope CurrentUser posh-docker

Earlier Windows versions

  1. Install PackageManagement PowerShell Modules Preview
  2. Open a powershell prompt
  3. Run Install-Module -Scope CurrentUser posh-docker

One thing I'd recommend, if you're on an earlier Windows version: instead of installing PackageManagement separately, just install Windows Management Framework 5.0 that way you get all of PowerShell 5.

As of this writing it's the latest stable, but next month (January 2017) WMF 5.1 is supposed to be released, FYI.

0
RJFalconer On

Accepted answer did not work for me.

  1. Delete %userprofile%\Documents\WindowsPowerShell\modules\posh-docker\*
  2. Run Install-Module -Scope AllUsers posh-docker from administrative powershell