Running PowerShell in a Docker container on VMware Photon OS
August 20, 2016 1 Comment
A 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:
- specify the location of the OVA file,
- accept the license agreement,
- specify the name of the virtual machine,
- 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:
- systemctl start docker
- 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.
Now you can start using PowerShell 6.0 Alpha on VMware Photon OS. Have fun!
Wow. That is so elegant and logical and clearly explained. Keep it up! I follow up your blog for future post.