%3CLINGO-SUB%20id%3D%22lingo-sub-1390046%22%20slang%3D%22en-US%22%3EUsing%20Docker%20Images%20in%20your%20Lab%3A%20Setup%20a%20Fedora%20environment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1390046%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Azure%20marketplace%20provides%20hundreds%20of%20Windows%20and%20Linux%20images%20that%20include%20a%20variety%20of%20common%20applications%20already%20preinstalled%2C%20such%20as%20SQL%20Server%2C%20Office%2C%20and%20more.%26nbsp%3B%20When%20you%20create%20your%20lab%2C%20you%20can%20select%20an%20image%20from%20the%20marketplace%20and%20then%20customize%20it%20further%20by%20installing%20additional%20software%20based%20on%20the%20unique%20needs%20for%20your%20class.%26nbsp%3B%20You%20can%20then%20export%20this%20custom%20image%20to%20the%20-ERR%3AREF-NOT-FOUND-Shared%20Image%20Gallery%20so%20that%20you%20can%20reuse%20your%20image%20to%20create%20other%20labs.%26nbsp%3B%20This%20is%20the%20easiest%20approach%20for%20creating%20and%20reusing%20a%20custom%20image%20and%20is%20well-suited%20for%20most%20types%20of%20classes.%3C%2FP%3E%0A%3CP%3EEven%20with%20the%20wide%20selection%20of%20images%20in%20the%20marketplace%20and%20the%20ability%20to%20customize%20them%2C%20you%20may%20still%20run%20into%20scenarios%20where%20this%20doesn%E2%80%99t%20suit%20your%20needs.%26nbsp%3B%20In%20this%20case%2C%20you%20have%20a%20couple%20of%20options%20that%20give%20you%20flexibility%20to%20use%20other%20types%20of%20images%20in%20your%20lab%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EUse%20a%20Docker%20container%20image.%3C%2FSTRONG%3E%26nbsp%3B%20With%20this%20option%2C%20you%20have%20access%20to%20over%20%3CA%20href%3D%22https%3A%2F%2Fhub.docker.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E100%2C000%20Docker%20container%20images%20from%20software%20vendors%2C%20open-source%20projects%2C%20and%20the%20community%3C%2FA%3E.%26nbsp%3B%20Or%20you%20can%20choose%20to%20use%20custom%20Docker%20images%20that%20you%20create.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EUse%20an%20image%20based%20on%20a%20VHD%20(Virtual%20Hard%20Disk)%20file.%3C%2FSTRONG%3E%26nbsp%3B%20This%20allows%20you%20to%20use%20VHD%20images%20created%20from%20a%20variety%20sources%2C%20ranging%20from%20on-premises%20virtualization%20tools%20to%20cloud-hosted%20VMs.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ESince%20both%20options%20are%20technically%20advanced%20scenarios%2C%20we%20recommend%20engaging%20with%20your%20IT%20department%20if%20you%20choose%20to%20pursue%20either%20of%20these.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20post%20will%20show%20how%20to%20use%20a%20Docker%20container%20image%20in%20your%20lab.%26nbsp%3B%20In%20a%20future%20blog%20post%2C%20we%20will%20show%20how%20to%20use%20VHD%20images.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1350896201%22%20id%3D%22toc-hId--1350896201%22%3EWhy%20use%20Docker%3F%3C%2FH2%3E%0A%3CP%3EUsing%20a%20Docker%20container%20image%20may%20be%20a%20suitable%20option%20when%20an%20image%20that%20you%20need%20isn%E2%80%99t%20currently%20available%20in%20the%20marketplace.%26nbsp%3B%20Let%E2%80%99s%20look%20at%20an%20example%20of%20this%20with%20a%20lab%20that%20needs%20to%20be%20created%20based%20on%20the%20Linux%20distro%2C%3CSTRONG%3E%20Fedora%3C%2FSTRONG%3E.%26nbsp%3B%20Here%20are%20some%20things%20to%20note%20about%20Fedora%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EFedora%20isn%E2%80%99t%20currently%20an%20-ERR%3AREF-NOT-FOUND-officially%20endorsed%20distro%20by%20Azure.%3C%2FLI%3E%0A%3CLI%3EA%20marketplace%20image%20for%20Fedora%20isn%E2%80%99t%20currently%20available%20for%20use%20with%20AzLabs.%3C%2FLI%3E%0A%3CLI%3EIt%20currently%20isn%E2%80%99t%20possible%20to%20create%20your%20own%20custom%20Fedora%20image%20using%20the%20VHD%20file%20approach%20mentioned%20in%20bullet%20%232%20above.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EHowever%2C%20Fedora%20does%20provide%20an%20-ERR%3AREF-NOT-FOUND-official%20Docker%20container%20image%20that%20you%20can%20use%20to%20run%20Fedora%20within%20a%20Docker%20container%20on%20each%20student%E2%80%99s%20VM.%26nbsp%3B%20Each%20Docker%20container%20provides%20its%20own%20isolated%20environment%20for%20software%20applications%20to%20run%20inside.%26nbsp%3B%20Conceptually%2C%20Docker%20containers%20are%20like%20nested%20VMs%20and%20can%20be%20used%20to%20easily%20deploy%20and%20run%20a%20wide%20variety%20of%20software%20applications%20based%20on%20container%20images%20provided%20by%26nbsp%3B-ERR%3AREF-NOT-FOUND-Docker%20Hub%20and%20other%20container%20registries.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22DockerDiagram.png%22%20style%3D%22width%3A%20517px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F191924iD40B6B3A8B4A2C15%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22DockerDiagram.png%22%20alt%3D%22Docker%2FVM%20Diagram%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EDocker%2FVM%20Diagram%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20above%20diagram%20shows%20how%20this%20configured%20%E2%80%93%20here%20are%20key%20points%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EStudents%20can%20directly%20use%20SSH%20and%20a%20GUI%20desktop%20client%20(such%20as%20X2Go)%20to%20connect%20to%20the%20Docker%20container%20(e.g.%20Fedora)%20from%20their%20local%20computer.%26nbsp%3B%20This%20is%20made%20possible%20by%3A%3CUL%20class%3D%22lia-list-style-type-circle%22%3E%0A%3CLI%3ECreating%20an%20SSH%20tunnel%20between%20the%20student%E2%80%99s%20computer.%3C%2FLI%3E%0A%3CLI%3EForwarding%20port%2022%20from%20the%20Docker%20container%20to%20the%20host%20lab%20VM.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EThe%20student%E2%80%99s%20lab%20VM%20that%20hosts%20the%20Fedora%20Docker%20container%20uses%20Ubuntu.%26nbsp%3B%20Although%20you%20could%20use%20Windows%20as%20the%20host%20VM%E2%80%99s%20OS%2C%20Ubuntu%20is%20used%20in%20this%20configuration%20because%20it%20has%20a%20few%20advantages%3A%3CUL%20class%3D%22lia-list-style-type-circle%22%3E%0A%3CLI%3ECurrently%2C%20to%20create%20Linux%20Docker%20containers%20on%20Windows%20hosts%2C%20this%20requires%20that%20you%20have%20Hyper-V%20enabled%20on%20the%20student%E2%80%99s%20VM%20which%20means%20you%20must%20use%20a%20-ERR%3AREF-NOT-FOUND-compute%20size%20that%20supports%20nested%20virtualization.%26nbsp%3B%20If%20you%20instead%20use%20a%20Linux%20distro%20as%20the%20host%20OS%2C%20you%20can%20use%20a%20smaller%20compute%20size.%3C%2FLI%3E%0A%3CLI%3EAzure%20Lab%20Services%20doesn%E2%80%99t%20currently%20open%20port%2022%20on%20Windows%20lab%20VMs.%26nbsp%3B%20This%20prevents%20creating%20an%20SSH%20tunnel%20so%20that%20students%20can%20directly%20connect%20to%20the%20Docker%20container%20on%20the%20lab%20VM.%26nbsp%3B%20Instead%2C%20students%20must%20first%20RDP%20to%20their%20lab%20VM%20to%20be%20able%20to%20access%20the%20Docker%20container%20if%20you%20use%20Windows%20as%20the%20host%20VM%E2%80%99s%20OS.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CDIV%3E%0A%3CH2%20id%3D%22toc-hId-1136616632%22%20id%3D%22toc-hId-1136616632%22%3EHow%20to%20Configure%3C%2FH2%3E%0A%3CDIV%3ETo%20configure%20this%20example%2C%20follow%20the%20steps%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-devtestlab%2Ftree%2Fmaster%2Fsamples%2FClassroomLabs%2FScripts%2FFedoraDockerContainer%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EFedora%20Docker%20Container%20sample%3C%2FA%3E.%26nbsp%3B%20After%20you've%20completed%20the%20steps%20in%20this%20sample%2C%20students%20will%20be%20able%20to%20connect%20directly%20from%20their%20local%20computer%20to%20the%20Fedora%20GUI%20desktop%3A%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22RemoteFedoraDesktop.png%22%20style%3D%22width%3A%20731px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F191923iCB9E4C024DB0AE2E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22RemoteFedoraDesktop.png%22%20alt%3D%22Fedora%20GUI%20Desktop%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFedora%20GUI%20Desktop%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CH2%20id%3D%22toc-hId--670837831%22%20id%3D%22toc-hId--670837831%22%3E%3CSPAN%3ENext%26nbsp%3Bsteps%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CDIV%3E%3CSPAN%3EThis%26nbsp%3Bsample%26nbsp%3Bshowed%26nbsp%3Bhow%26nbsp%3Byou%26nbsp%3Bcan%26nbsp%3Buse%26nbsp%3BDocker%26nbsp%3Bimages%26nbsp%3Bin%26nbsp%3Byour%26nbsp%3Blab.%26nbsp%3B%26nbsp%3BAlthough%26nbsp%3Bwe%26nbsp%3Bshowed%26nbsp%3Busing%26nbsp%3BFedora%26nbsp%3Bwith%26nbsp%3BDocker%2C%26nbsp%3Bthe%26nbsp%3Bsame%26nbsp%3Bidea%26nbsp%3Bcan%26nbsp%3Bbe%26nbsp%3Bapplied%26nbsp%3Bto%20other%20types%26nbsp%3Bof%26nbsp%3BDocker%26nbsp%3Bimages.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EIf%26nbsp%3Byou%26nbsp%3Bchoose%26nbsp%3Bto%26nbsp%3Bcreate%20custom%26nbsp%3BDocker%26nbsp%3Bimages%2C%26nbsp%3Byou%26nbsp%3Bmay%26nbsp%3Balso%26nbsp%3Bwant%26nbsp%3Bto%26nbsp%3Blook%26nbsp%3Bat%26nbsp%3Bhow%26nbsp%3Bto%26nbsp%3Bback%26nbsp%3Bup%26nbsp%3Byour%26nbsp%3BDocker%26nbsp%3Bimages%26nbsp%3Bin%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fcontainer-registry%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%3EAzure%20Container%26nbsp%3BRegistry%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E.%26nbsp%3B%26nbsp%3BIn%26nbsp%3Baddition%2C%26nbsp%3Bwe%26nbsp%3Bencourage%26nbsp%3Byou%26nbsp%3Bto%26nbsp%3Blook%26nbsp%3Bat%26nbsp%3Bthe%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Flab-services%2Fclassroom-labs%2Fclass-type-big-data-analytics%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%3EBig%26nbsp%3BData%26nbsp%3BAnalytics%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3Bclass%26nbsp%3Btype%26nbsp%3Bwhich%20shows%20another%26nbsp%3Bexample%26nbsp%3Bof%26nbsp%3Busing%26nbsp%3BDocker.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CP%3ELast%20but%20not%20least%2C%20if%20you%20have%20images%20that%20you%20would%20like%20to%20see%20in%20the%20marketplace%20that%20aren%E2%80%99t%20currently%20available%2C%20we%20would%20be%20interested%20to%20know%20this%20%E2%80%93%20please%20let%20us%20know%20by%20leaving%20a%20comment%20here%20and%20we%E2%80%99ll%20follow%20up%20with%20you.%26nbsp%3B%20Thanks!%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1390046%22%20slang%3D%22en-US%22%3E%3CP%3EEven%20with%20the%20wide%20selection%20of%20images%20in%20the%20marketplace%20and%20the%20ability%20to%20customize%20them%2C%20you%20may%20still%20run%20into%20scenarios%20where%20this%20doesn%E2%80%99t%20suit%20your%20image%20needs.%26nbsp%3B%20In%20this%20post%2C%20we'll%20show%20you%20how%20you%20can%20use%20a%20Docker%20container%20image%20in%20your%20lab%20to%20setup%20a%20Fedora%20environment.%26nbsp%3B%20Using%20Docker%2C%20you%20have%20access%20to%20over%26nbsp%3B-ERR%3AREF-NOT-FOUND-100%2C000%20Docker%20container%20images%20from%20software%20vendors%2C%20open-source%20projects%2C%20and%20the%20community.%26nbsp%3B%20Or%20you%20can%20choose%20to%20use%20custom%20Docker%20images%20that%20you%20create.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1390046%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELab%20Services%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

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!