samneirinck / posh-docker Goto Github PK
View Code? Open in Web Editor NEWPowershell tab completion for Docker
License: MIT License
Powershell tab completion for Docker
License: MIT License
Make it easier to install posh-docker, either via chocolatey or a 1 line install-command
Hi @samneirinck,
It would very convenient if ConvertFrom-Docker
were in a separate module.
I am authoring a module, DockerHelpers, where I would like to take a dependency on posh-docker
but can't as explained below.
DockerHelpers
module uses ConvertFrom-Docker
for some of it's implementation. But DockerHelpers
should not add tab completion to the powershell console.
So currently I'm copying ConvertFrom-Docker
into DockerHelpers
module - not ideal for a number of reasons.
Alternatively, I'd be very happy for ConvertFrom-Docker
to be contributed to DockerHelpers. Obviously that would mean posh-docker
taking an external dependency. However, powershell Install/Import
commands would make that transparent to the consumer of posh-docker
.
If you were willing to contribute then I'd make you a contributor to DockerHelpers so that you can modify the sources.
Thanks
Christian
Hi. Thanks for this awesome project. It works great for me, except this one thing. Some of my docker containers have multiple names. This results in the following output, when asking for the available docker container names:
C:\Users\XXX> docker ps -a --no-trunc --format "{{.Names}}"
guaccomplete_guacamole_1
guaccomplete_mysql_1,guaccomplete_guacamole_1/guaccomplete_mysql_1,guaccomplete_guacamole_1/mysql,guaccomplete_guacamole_1/mysql_1
guaccomplete_guacd_1,guaccomplete_guacamole_1/guaccomplete_guacd_1,guaccomplete_guacamole_1/guacd,guaccomplete_guacamole_1/guacd_1
Now, when I use TAB to autocomplete my container name, it will insert the whole line including all comma-separated names, which does not work.
C:\Users\XXX> docker start guaccomplete_guacd_1,guaccomplete_guacamole_1/guaccomplete_guacd_1,guaccomplete_guacamole_1/guacd,guaccomplete_guacamole_1/guacd_1
Error response from daemon: No such container: guaccomplete_guacd_1,guaccomplete_guacamole_1/guaccomplete_guacd_1,guaccomplete_guacamole_1/guacd,guaccomplete_guacamole_1/guacd_1
Error: failed to start containers: guaccomplete_guacd_1,guaccomplete_guacamole_1/guaccomplete_guacd_1,guaccomplete_guacamole_1/guacd,guaccomplete_guacamole_1/guacd_1
I guess posh-docker needs to split the container names by comma before autocompleting.
Tested using Docker version 1.11.2, build b9f10c9.
This really sucks for Using where object against
Support for the docker-compose
command would be great.
I was thinking of wrapping docker.exe
to work with TabExpansionPlusPlus.
Wanted to get your thinking about that.
Thanks
I tried the install instructions in your readme as well as the ones found here.
Neither method had any affect on autocompletion.
I'm on Windows 10 x64 (Build 14986) / Docker 1.13
Get-Module posh-docker
returns
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.6.0 posh-docker ConvertFrom-Docker
Add tests to check if new functionality doesn't break older docker versions
Hey @samneirinck, I know a lot of docker users that would love this updated to current CLI commands and sub-commands, options, etc.
Maybe we Docker Captains can help spread the word and get you some help with fixes and new features, but I have two questions first:
Are you still willing to lead this repo by accepting PR's, commenting on issues, etc? It would be great if we could use the same PowerShell Module name and repo.
Can you describe a list of issues or needed features to get it working with old and new command format and options?
CC: @StefanScherer
Docker 1.13 changed the command line interface.
Can you add support for this?
Thanks a lot!
Running
Install-Module -Scope CurrentUser posh-docker
yields
Install-Module : Parameter named "Scope" not found.
In Zeile:1 Zeichen:16
+ Install-Module -Scope CurrentUser posh-docker
+ ~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Install-Module], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Install-Module
Running
Install-Module posh-docker
yields
Module posh-docker was not found in central repository
In C:\Users\felix\OneDrive\Dokumente\WindowsPowerShell\Modules\PsGet\PsGet.psm1:692 Zeichen:13
+ throw "Module $Module was not found in central repository ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Module posh-doc...tral repository:String) [], RuntimeException
+ FullyQualifiedErrorId : Module posh-docker was not found in central repository
What am I missing?
Apparently, there is a conflict between these two modules. After installing TabExpansionPlusPlus, posh-docker stopped working. Removing Import-Module TabExpansionPlusPlus
directive from PowerShell profile fixes the issue. Order of import of TabExpansionPlusPlus and posh-docker doesn't affect the problem.
Hi ! I don't know if it is even possible, but... is there any chance to get the tab completion working through "Cmder" terminal with the docker invite added to it ? If yes, it would be helpful to find an install doc here :)
To get docker invite, here is my Cmder config :
/icon "C:\Program Files\Docker Toolbox\docker-quickstart-terminal.ico"
(depending of your own path)""C:\Program Files\Git\bin\bash.exe" --login -i "C:\Program Files\Docker Toolbox\start.sh" -new_console:d:"C:\Program Files\Docker Toolbox""
(again, depending of your own path)Edit :
To enable tab completion on a PowerShell invite from Cmder, you just need to remove the "-NoProfile" command option in the "Startup/Task"
But still impossible to get tab completion on the new "docker" invite, unfortunately.
Great extension and I love it! The README outlines that options would be tab completable but I'm not able to get it to work.
Docker commands like start, stop etc auto complets like a charm but I'm not able to get the respective options to auto complete.
e.g. When I type docker start --att
, and press tab
key I should see docker start --attach
but it isn't.
I'm running powershell 5 on Windows 10 ,but I've also tested this on Windows Server 2016 and also no love :(
Every time I open a powershell window I get this error:
Import-Module : The specified module 'posh-docker' was not loaded because no valid module file was found in any module directory.
Any thoughts on how to make it go away?
The Docker client now has a new structure with sub commands.
For example:
docker container --help
docker container run ...
docker image --help
docker image ls
How can posh-docker be enhanced to support tab completion for these sub commands as well?
Right now it seems to only get container names, but it would be nice to get image names for docker run
, docker rmi
, and any other command that works with images.
Right now, docker run
will show container names if you tab, which is wrong.
Could this be integrated into posh-git? That way it would come with GitHub for Windows
PS C:\WINDOWS\system32> Install-Module -Scope CurrentUser posh-docker
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files (x86)\PackageManagement\ProviderAssemblies' or
'C:\Users\Christopher\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet
provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PS C:\WINDOWS\system32> Import-Module posh-docker
Import-Module : The specified module 'posh-docker' was not loaded because no valid module file was found in any module directory.
At line:1 char:1
+ Import-Module posh-docker
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (posh-docker:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Firstly, I'm a powershell virgin, though I like to think I can follow simple instructions. Please tell me what I'm doing wrong here? This is on Windows 10. I used admin PS.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.