Using Docker Images in your Lab: Setup a Fedora environment

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

The Azure marketplace provides hundreds of Windows and Linux images that include a variety of common applications already preinstalled, such as SQL Server, Office, and more.  When you create your lab, you can select an image from the marketplace and then customize it further by installing additional software based on the unique needs for your class.  You can then export this custom image to the Shared Image Gallery so that you can reuse your image to create other labs.  This is the easiest approach for creating and reusing a custom image and is well-suited for most types of classes.

Even with the wide selection of images in the marketplace and the ability to customize them, you may still run into scenarios where this doesn’t suit your needs.  In this case, you have a couple of options that give you flexibility to use other types of images in your lab:


Since both options are technically advanced scenarios, we recommend engaging with your IT department if you choose to pursue either of these.


This post will show how to use a Docker container image in your lab.  In a future blog post, we will show how to use VHD images. 


Why use Docker?

Using a Docker container image may be a suitable option when an image that you need isn’t currently available in the marketplace.  Let’s look at an example of this with a lab that needs to be created based on the Linux distro, Fedora.  Here are some things to note about Fedora:

  • Fedora isn’t currently an officially endorsed distro by Azure.
  • A marketplace image for Fedora isn’t currently available for use with AzLabs.
  • It currently isn’t possible to create your own custom Fedora image using the VHD file approach mentioned in bullet #2 above.

However, Fedora does provide an official Docker container image that you can use to run Fedora within a Docker container on each student’s VM.  Each Docker container provides its own isolated environment for software applications to run inside.  Conceptually, Docker containers are like nested VMs and can be used to easily deploy and run a wide variety of software applications based on container images provided by Docker Hub and other container registries.

Docker/VM DiagramDocker/VM Diagram


The above diagram shows how this configured – here are key points:

  • Students can directly use SSH and a GUI desktop client (such as X2Go) to connect to the Docker container (e.g. Fedora) from their local computer.  This is made possible by:
    • Creating an SSH tunnel between the student’s computer.
    • Forwarding port 22 from the Docker container to the host lab VM.
  • The student’s lab VM that hosts the Fedora Docker container uses Ubuntu.  Although you could use Windows as the host VM’s OS, Ubuntu is used in this configuration because it has a few advantages:
    • Currently, to create Linux Docker containers on Windows hosts, this requires that you have Hyper-V enabled on the student’s VM which means you must use a compute size that supports nested virtualization.  If you instead use a Linux distro as the host OS, you can use a smaller compute size.
    • Azure Lab Services doesn’t currently open port 22 on Windows lab VMs.  This prevents creating an SSH tunnel so that students can directly connect to the Docker container on the lab VM.  Instead, students must first RDP to their lab VM to be able to access the Docker container if you use Windows as the host VM’s OS.

How to Configure

To configure this example, follow the steps in the Fedora Docker Container sample.  After you've completed the steps in this sample, students will be able to connect directly from their local computer to the Fedora GUI desktop:
Fedora GUI DesktopFedora GUI Desktop

Next steps

This sample showed how you can use Docker images in your lab.  Although we showed using Fedora with Docker, the same idea can be applied to other types of Docker images.  If you choose to create custom Docker images, you may also want to look at how to back up your Docker images in Azure Container Registry.  In addition, we encourage you to look at the Big Data Analytics class type which shows another example of using Docker.

Last but not least, if you have images that you would like to see in the marketplace that aren’t currently available, we would be interested to know this – please let us know by leaving a comment here and we’ll follow up with you.  Thanks!


REMEMBER: these articles are REPUBLISHED. Your best bet to get a reply is to follow the link at the top of the post to the ORIGINAL post! BUT you're more than welcome to start discussions here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.