Powershell: Docker PowerCLI Core and Microsoft/Powershell - (docker -it switch)

Assumptions:
Docker running on MacOS.  (Likely runs the same on any other OS, minor differences)

Summary:
While I appreciate William Lam's posts on Docker and PowerCLICore; I'm kind of dumb and need explanations on the simpler aspects of docker.  So for those who would like to know what the options in docker mean (to explore at least) and why it can looks strange even looking at 'help', here is how I understand it.  This can also be applied to Microsoft/Powershell container image as well.

Details:
docker run --rm -it -v /Users/cnakagaki/Downloads/:/tmp/scripts vmware/powerclicore

The above line will pull the powerclicore container from docker hub (if not already 'pulled'), run it in interactive mode (w/ pseudo TTY, needed), and mount my local Downloads directory to /tmp/scripts within the docker container.

The part that mainly threw me off was the syntax combination of '-it' which essentially translates to -i (interactive) and -t (pseudo TTY).

Graphic below breaks it down to hopefully get a better basic understanding.


Further Research Needed:
I'm still having difficulty making Lam's examples work of running a powershell script from my mounted volume.  It works fine when working in session, but not calling it from this line like outlined in Lam's article:
docker run --rm -it -v ~/Downloads/:/tmp/scripts vmware/powerclicore /tmp/scripts/test.ps1
*"~" = /Users/CurrentUser/
I simply get a permission denied error.  Once I understand how to get this working, this'll be immensely useful in using docker and vmware/powerclicore container to distribute powershell/powercli workloads without actually installing it.










Comments

Popular posts from this blog

NSX-T: vCenter and NSX-T Inventory out of Sync (Hosts in vSphere not showing up in NSX-T)

MacOS: AnyConnect VPN client was unable to successfully verify the IP forwarding table modifications.

vCenter: Cluster Skip Quickstart Workflow via API