Running PowerShell in a Docker container on VMware Photon OS

PowerShell logoA few days ago Microsoft provided PowerShell as an open source project on GitHub, available on Windows, Linux and macOS! The first open source release is PowerShell 6.0 Alpha. In this blog post, I will show you how to run the new PowerShell version in a Docker container on VMware Photon OS.

To get VMware Photon OS running, you can download it from https://vmware.github.io/photon/. I downloaded the Photon OS, Version 1.0 — OVA with virtual hardware v11 and imported into my vSphere environment. If you use the vSphere client, click on File | Deploy OVF Template... to import the OVA file. During the deployment, you have to:

  1. specify the location of the OVA file,
  2. accept the license agreement,
  3. specify the name of the virtual machine,
  4. specify the disk format (Thick Provision Lazy Zeroed, Thick Provision Eager Zeroed, or Thin Provision),

TIP: If you create a template of the first Photon OS virtual machine you install, you can use this template to easily deploy new Photon OS virtual machines.

After starting the Photon OS virtual machine, login with user root. The default password for the Photon OS root user is changeme. You have to change the password during first login.

To start and enable Docker in the Photon OS virtual machine, use the following commands:

  1. systemctl start docker
  2. systemctl enable docker

Now, you are ready to start PowerShell. The command provided by the PowerShell team on GitHub (docker run -it powershell) did not work for me. Docker was not able to find the location of the PowerShell Docker container. A Google search gave me a working command:
docker run -it manojlds/powershell

In the following screenshot of the Photon OS console, you will see the complete session after my initial login until the PowerShell prompt.
PowerShell running on VMware Photon OS

Now you can start using PowerShell 6.0 Alpha on VMware Photon OS. Have fun!

Advertisements

About Robert van den Nieuwendijk
Robert van den Nieuwendijk is a freelance senior systems engineer with over 30 years of experience in the IT industry. He focusses on VMware vCloud Suite and Microsoft Windows Server. He tries to automate as much of his work as possible using Microsoft PowerShell. Robert is the author of the books “Learning PowerCLI” and “Learning PowerCLI – Second Edition.” Robert is a frequent contributor and moderator at the VMware VMTN Communities. He has a bachelor degree in software engineering and holds the following IT certifications and accreditations: VSP 2016, VTSP 2016, VCP4-DCV, VCP5-DCV, VCP6-Cloud, VCP6-CMA, VCA-Cloud, VCA-WM, VCA-NV, VMSP, VMTSP, ZCS, ZCP, ZCP-Cloud, MCSE, MCSA, MCP, MCP+I, PRINCE2 Foundation and ITIL Foundation. In 2012, 2013, 2014, 2015, 2016 and 2017 Robert received the VMware vExpert award for his contribution to the community of VMware users over the past year. PernixData made him in 2015 a member of the PernixPro.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: