Getting Started with Docker & VMware Photon OS

There is a ton of good information out there about Docker, but I wanted to provide you with a more consolidated walk through that gets you started from ground zero. In the spirit of virtualization, isolation, and containerization, this guide is going to leverage the open source Photon OS from VMware. Let’s get started!

  1. Go to vmware.github.io/photon/ and download the appropriate ISO or OVA for your environment.
    1. For the purposes of this guide, I deployed the Minimal hw v11 OVA into my vSphere cluster, but I have successfully done the same thing within Workstation.
    2. You can also build a VM from scratch (1 vCPU, 384MB RAM, 8GB Disk minimum) and use the ISO (which will also allow you to deploy the “Full Version.”) Note that the OVA will deploy a VM with 1 vCPU, 2GB RAM, and 16GB Disk.
  2. Once deployed and powered on, either use the hypervisor’s console or SSH into the VM, then login with “root” and “changeme”
    1. The first time you log in, you will be required to change the password.
  3. Surprisingly,  Docker isn’t running, so start Docker, then verify it is working, by running:
    1. systemctl start docker
      docker ps

      The “docker ps” command lists running containers, which we don’t have yet, but will error out  if Docker isn’t running properly. You will see an output like “CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES” if Docker is working.

  1. Now, we can run a simple command to launch and run a container, but in my opinion this is not a true Hello World common to most programming 101 tutorials, but I will include these examples anyway. The first time you run this, the Ubuntu image will be downloaded.
    1. docker run ubuntu /bin/echo 'Run an Ubuntu based container, print this text to the screen, then close'

      Run the command again and you will notice that it runs much more quickly!
      Notice also that if you run a “docker ps” that nothing is running.

  2. Docker has an already built application, which you can download, run and interact with using the following commands from the Photon VM:
    1. docker run -d -p 80:5000 training/webapp python app.py
      docker ps
  3. From a web browser on your computer enter the IP of the Photon VM in the address bar and you should now see a more proper “Hello world!”

Leave a Reply

Your email address will not be published. Required fields are marked *