Skip to content

Running Photon OS on Google Compute Engine

Gregory Murray edited this page Sep 15, 2015 · 11 revisions

#What is Photon OS? Photon OS is a tech preview of an open source, Linux container host runtime optimized for vSphere. Photon OS is extensible, lightweight, and supports the most common container formats including Docker, Rocket (rkt) and Garden. Photon OS includes a small footprint, yum-compatible, package-based lifecycle management system – called “tdnf”- and, alternatively, supports 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 OS allows seamless migration of container based apps from development to production.

#Introduction This document explains how to get started using Photon OS as a runtime environment for Linux containers by running Photon OS as a VM instance on Google Compute Engine. This guide will provide step-by-step instructions on downloading Photon OS, provide details of the various install options and provide a walkthrough of installing the Photon OS image for GCE.

Once Photon OS is installed, this guide will also provide instructions on how to demonstrate how simple it can be to deploy a containerized application with Docker and will highlight the installation of a web server simply by running one command!

#Photon OS on GCE Prerequisites The following items are required for preparing and launching Photon OS on Google Compute Engine:

  • An account on Google Compute Engine
  • Google Cloud SDK
  • Photon OS image for GCE

#Downloading Photon OS VMware recommends that administrators use the Photon OS image for Google Compute Engine (GCE) to create Photon OS instances on GCE. Earlier releases of Photon required for heavy modification of the Photon instance to make the image compatible with GCE; with Tech Preview 2, VMware releases pre-modified images for popular cloud providers.

While it’s possible to create an unmodified Photon OS instance by installing from the ISO and modifying the image to make the system compatible, these steps and their associated detailed documentation were rendered obsolete with the release of the Photon OS image for GCE.

You can download the Photon OS for GCE from here.

#Installing Photon OS on Google Compute Engine After you’ve downloaded the Photon OS image for GCE, begin by creating a new bucket to store your Photon OS image for GCE.

gce1

Once you’ve created the bucket, you’re ready to upload the Photon OS image. While viewing the bucket that you’ve created, click the “Upload files” button, navigate to your Photon OS image and click the “Choose” button. The lower-right corner of the screen should show an upload progress window. As shown below, you should see your Photon OS compressed image in the file list for the bucket that you’d created when the upload is complete.

gce2

Next, we need to create a new image. Click on “Images” in the “Compute” category in the left panel; then, click on the “New Image” button. Enter a name for the Image in the Name field and change the “Source Type” to “Cloud Storage Object” using the pull-down menu. Then, in the “Cloud Storage object path” field, enter the bucket name and filename as the path to the Photon OS image for GCE. In this example, where the bucket was named “photon_storage,” we entered:

gs:// photon_storage/photon-gce.tar.gz

Note: The new image form will autopopulate the gs:// file path prefix.

gce3

After you’re finished completing the name and Cloud Storage object path, click the “Create” button to create your image. You should be returned to your Images catalog and your Photon OS image should be at the top of the list. To create an instance, check the box next to the Photon OS image and click the “Create Instance” button. On the “Create a new instance” form, provide a name for this instance, confirm the Zone into which this instance is to be deployed and, before clicking “Create,” place a check in the boxes for “Allow HTTP traffic” and “Allow HTTPS traffic.”

Outside of this demo, your application may or may not require these firewall rules. Please choose accordingly outside of this demo. However, since we will demonstrate a running web server container, we want these ports to be open for our instance.

gce4

When the instance is created you will be returned to your list of VM instances. If you click on the instance, the status page for the instance will allow you to SSH into your Photon OS environment using the SSH button at the top of the panel.

At this point, your instance is running and you are ready to start the Docker engine and run a container workload! Installing a Containerized 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 initialize 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:

gce5

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 Photon OS using containers. To test that your Web Server is active, we need to get the IP address of the Photon OS Virtual Machine. To get the IP address, enter the following command ifconfig. This command will display a list of network adapters connected to the virtual machine. Typically, the web server daemon will be bound on “eth0;” record the IP address associated with eth0. Alternatively, visit the status page of your Photon OS instance in GCE where the IP address is listed under “External IP."   Start a browser on your host machine and enter the IP address of your Photon OS Virtual Machine. The following screen should appear and that will show that your web server is active:

gce6

You can now run any other containerized application from Docker Hub or your own containerized application within Photon OS.

We hope you enjoy using Photon OS as much as we enjoy creating it!

Clone this wiki locally