Getting Started Using Project Photon on VMware Fusion/Workstation What is Project Photon? Project Photon is a tech preview of an open source, Linux container host runtime optimized for vsphere. Photon is extensible, lightweight, and supports the most common container formats including Docker, Rocket (rkt) and Garden. Project Photon includes a small footprint, yum-compatible, package-based lifecycle management system, and will support an rpm-ostree image-based system versioning. When used with development tools and environments such as VMware Fusion, VMware Workstation, HashiCorp (Vagrant and Atlas) and production runtime environment (vsphere, vcloud Air), Photon allows seamless migration of container based Apps from development to production. Introduction This document explains how to get started using Project Photon as a runtime environment for Linux containers by running Project Photon as a virtual machine within VMware Fusion or Workstation. This guide will provide step-by-step instructions on how to download Project Photon, provide details of the various install options and provide a walkthrough of installing the full Project Photon distribution. Once Project Photon is installed, this guide will also provide instructions on how to demonstrate how simple it can be to deploy a containerised application with Docker and will highlight the installation of a web server simply by running one command!. About the Authors Andy Jenkins is a Solution Architect and a member of the Cloud Native Applications Team based in the UK - @vstokie Robbie Jerrom is a Solutions Architect and a member of the Cloud Native Applications Team based in the UK - @robbiej
Photon Install - Prerequisites In order to install and start using Project Photon with VMware Fusion the following pre-requisites must be satisfied: - Either download the latest Photon ISO from here or clone the GitHub Photon repository and make the ISO using the instructions found on the GitHub repo. This guide is based on the version 7.1.1 of VMware Fusion Professional as per the Screenshot below. Our recommendation is to always use the latest version; although, anything from v7.0 onwards should work as advertised. Keep in mind, that Photon is being released, initially, as a tech preview as such should you encounter any issues, please let us know @VMwarePhoton. Downloading Photon As per the pre-requisites download the latest ISO image from here or clone the GitHub Photon repository and make the ISO.
Installing Photon from an ISO Image With the latest ISO image downloaded into a folder of your choice, Open VMware Fusion and Select File->New. The following screen will appear: -
Double click on the Install From disk or image option from the left hand side of the screen. Drag the Photon.iso file, from the folder where you ve saved it, onto the Create New Virtual Machine window. The screen should look similar to the following:- Select the Photon.iso file, by clicking on it and ensuring that it is highlighted, then, click Continue. You will now be prompted for the selection of the Operating System to be used to create the Virtual Machine.
First, select Linux, in the left panel, then, select Other Linux 3.x kernel 64bit, as shown below: Click Continue. Before finishing the Photon Virtual Machine Creation, we strongly recommend that you customise the Virtual Machine and remove any unwanted devices that are not needed for a container runtime environment.
To remove un-necessary devices, from the screen shown below, select Customize Settings Choose a name for your Virtual Machine and the folder into which you would like to create the Virtual Machine. If the default folder of Virtual Machines is acceptable, click Save. A new screen will appear as per below that will allow virtual hardware customisation to the new Virtual Machine: - It is our recommendation that the following components are removed, since they re not used by Project Photon: Select Sound Card and un-tick the Connect Sound Card Option and then select Show All Select Camera and press the Remove Camera button in the bottom left hand corner and then select Show All
Select Printer and press the Remove Printer Port button in the bottom left hand corner and then select Show All Select USB & Bluetooth and un-tick the Share Bluetooth devices with Linux setting and then select Show All Select Display and un-tick the Accelerate 3D Graphics option and then select Show All Select Advanced and tick the Pass Power Status to VM option and then select Show All Now that we have removed the un-necessary components we can now optimize the compute resources available to the Photon Virtual Machine. Container Runtime resources should be adjusted to align with the size of containers running inside them. For the purpose of testing and education we recommend the following settings as a baseline: - Processors & Memory Please Note: Ensure that Enable Hypervisor Applications in this Virtual Machine under the Advanced Dropdown is deselected, as this is not supported in a Container Runtime Environment. At this stage we have now made all the necessary customisations and we are ready to begin the installation process. Return to the Fusion main menu, select the Photon Virtual Machine and press the Play button to power on the host and start the installation.
Within a few seconds the Project Photon Installer Boot Menu will appear.
Select Install to proceed. The Installer will detect 1 x Disk which the 8GB disk image configured as part of the default virtual hardware setup, select the disk image and press enter. You will be prompted to confirm it is okay to erase the entire disk, select yes to accept.
You will now presented with 4 installation options:- Each install option provides a different runtime environment, depending on your requirements: Photon OS (Micro): Photon Micro is a completely stripped down version of Photon that can serve as an application container, but doesn t have sufficient packages for hosting containers. This version is only suited for running an application as a container. Due to the extremely limited set of packages installed, this might be considered the most secure version. Photon Container OS (Minimum): Photon Minimum is a very lightweight version of the container host runtime that is best suited for container management and hosting. There is sufficient packaging and functionality to allow most common operations around modifying existing containers, as well as being a highly performant and full-featured runtime.
Photon Full OS (All): Photon Full includes several additional packages to enhance the authoring and packaging of containerized applications and/or system customization. For simply running containers, Photon Full will be overkill. Use Photon Full for developing and packaging the application that will be run as a container, as well as authoring the container, itself. For testing and validation purposes, Photon Full will include all components necessary to run containers. Photon Custom OS: Photon Custom provides complete flexibility and control for how you want to create a specific container runtime environment. Use Photon Custom to create a specific environment that might add incremental & required functionality between the Micro and Minimum footprints or if there is specific framework that you would like installed. For the purposes of this how-to guide, select Option 3 Photon Full OS (All) this will install the most complete set of Photon packages. Once highlighted press the Return key on your keyboard. You will now be prompted for a hostname as per the screenshot below: -
Enter a hostname of your choosing and press Enter. You will now be prompted for a root password: - Select a password of your choosing; note: Photon will not permit commonly used dictionary words to be set as a root password. The installation process will now begin. Typically, a Full install will take approximately 30-60 seconds to complete. Once the install is complete you will get a confirmation prompt on the screen stating Congratulations, Photon has been installed in xx secs, Press any key to continue to boot - Press any key and you will be all set.
As the initial boot process begins you will see this final loading screen before you are taken to a root login command prompt:
At the command prompt enter root as your user and you will be prompted for you root password. Enter as per the install and you will then be taken to the command prompt. You have now successfully setup Project Photon and are ready to use your container runtime environment.
Installing a Containerised Application to Help Demonstrate Capability Now that you have your container runtime environment up and running, you may be wondering, what can I do now? A command prompt is not the most exciting! To help to demonstrate the ease in which you can deploy a containerized application, we will showcase how you can quickly get a Web Server up and running. For this example, we will use the popular open source Web Server Nginx. The Nginx application has a customized VMware package and published as a dockerfile and can be downloaded, directly, through the Docker module from the Docker Hub. To run Docker from the command prompt, enter the command below to initialise the docker engine: - systemctl start docker To ensure docker daemon service runs on every subsequent VM reboot, enter : systemctl enable docker Now the docker daemon service is running, it is a simple task to pull and start the Nginx Web Server container from Docker Hub. To do this, type the following command: - docker run -d -p 80:80 vmwarecna/nginx
This will then pull the Nginx Web Server files and appropriate dependent containers to ensure this containerized application can run. You will see a screenshot similar to below, as the container and dependencies are downloaded and the container is prepared to run: - Once docker run process is completed, you will be returned to the command prompt. You now have a fully active website up and running through typing just a single command within Project Photon using containers. To test that your Web Server is active, we need to get the IP address of the Project Photon Virtual Machine. To get the IP address, enter the following command ifconfig. This will now display a list of adapters connected to the virtual machine. Typically, the web server daemon will be bound on eth0.
Start a browser on your host machine and enter the IP address of your Project Photon Virtual Machine. The following screen will appear and that will show that your web server is active: - You can now run any other containerized application from Docker Hub or your own containerized application within Project Discus. We hope you enjoy using Photon as much as did creating it!