Search This Blog

Monday, April 14, 2014

Docker (LXC) Enabled Images In SoftLayer

Forward

Anyone that's worked with me in the past 6-9 months knows that docker and Linux Containers (LXC) are near and dear to my heart. I firmly believe these technologies are poised to change our modern Cloud era and in fact I'd assert we're already beginning to see that change solidify now. There are numerous public resources which discuss the benefits of LXC as a "virtualization technology", but let's quickly recap some of those before going further. In particular let's focus on LXC from a docker perspective.



Docker LXC benefits include:
  • Near bare metal performance at runtime.
  • Operations (start / stop / create / etc) are very performant (millisecond or seconds).
  • Seamless "migration" between virtual and bare metal environments.
  • Lightweight
    • Images with Just enough Operating System (JeOS).
    • Minimal per container penalty equating to greater density potential.
  • Supported with out-of-the-box modern Linux kernel.
  • Broad array of images and artifacts in the community (from databases to web apps and almost everything in between).
  • Vibrant open source community / ecosystem and growing industry interest.

I also believe SoftLayer's infrastructure is positioned to be a leader in hosting docker LXC based development and solutions as they support a wide range of offerings; from Virtual Machines to bare metal. This mixture of both bare metal and virtual environments opens up a number of use cases with LXC based technologies which are not possible with traditional Virtual Machines (VMs). For example, consider these high level conceptual use cases:

  • Develop apps / solutions / components on VM based containers and once ready for production seamlessly migrate to bare metal thereby reducing development costs.
  • Prototype and develop solutions in Cloud  based containers then export, migrate and deploy on-premise bare metal without change to the container / app.
  • Create, share and reuse modular self-contained components without worry of dependency hell.
  • Encourage a "PaaS 2.0" ecosystem whereby users create content in a public catalog rather than just consuming it.

Today you can head out to SoftLayer and install docker manually on your instance(s); it's quite an easy task. However, I wanted to make this a bit easier and thus I've take decided to create and publish public docker enabled images in SoftLayer. These images can help you jump-start your docker LXC experience in SoftLayer which is the topic of this post.



Docker enabled images in SoftLayer

A handful of public images have recently been published to SoftLayer which are pre-installed with docker and have the docker daemon set to auto-start on Operating System boot. Using these images to provision instances will save you the time of having to manually install docker and it's dependencies. With these images when your instance is provisioned docker will be up and ready to go immediately.

You can find the images by viewing Virtual > Image Templates and then selecting Public Images from the SoftLayer web-based dashboard. From there search on template name docker to find the available images as shown below.


SoftLayer public docker images


As you can see by the naming scheme of the image's they have the form:


<Base Operating System Version> - <Linux Kernel Version> - <docker version>

If you aren't familiar with SoftLayer images, below is a recap of the image types provided by SoftLayer:

  • Standard -- Available for provisioning of Cloud Compute Instances (CCIs aka Virtual Machines). Not available for provisioning on Bare Metal Instances (BMIs).
  • Flex -- SoftLayers device neutral image type available for provisioning of CCIs or BMIs. However standard images are faster for provisioning CCIs.

The images were created as follows:
  • Provision an instance using standard SoftLayer image templates.
    • Ubuntu, CentOS, RHEL, etc.. In all cases I've used the 64bit "minimal" image available in SoftLayer.
  • Install docker using the documented means for the Operating System.
  • Verify docker is installed and running on the instance.
  • Capture the instance to a SoftLayer image template.
  • Validate the image using the steps in the section below on 'image certification'.

Thus, no additional software is installed on the images beyond what is pulled in as dependencies for the docker install.

How to provision the docker image in SoftLayer

Provisioning a SoftLayer instance with these images is the same process as provisioning any other public image:
  • Create and setup your SoftLayer account.
  • In the SoftLayer web dashboard, navigate to: Virtual > Image Templates
  • Click on Public Images
  • In the Search Options, search on the name docker
  • Click on Order next to the image you wish to provision and select your instance type (e.g. hourly or monthly)
  • Specify the details for your instance such as the CPUs, memory, etc. and submit the instance order
  • Once your instance has provisioned access it via SSH or whatever means you typically use
  • docker will be pre-installed and the docker daemon will be running


Note that you can also provision an hourly Bare Metal Instance from a flex image, but the process is slightly elongated:

  • Navigate to Sales > Add Bare Metal Server
  • Select the hourly bare metal server you wish to create
  • Specify your instance's properties (networking, disk, etc.)
  • Ensure to select the same Operating System as the docker enabled image you plan to provision. For example if you are wanting to provisioning the CentOS docker enabled image, you should use the CentOS 6.5 64bit minimal image for your hourly bare metal instance
  • Complete your order for the instance
  • Once the instance is provisioned, navigate to Bare Metal > OS Reloads
  • Locate your hourly BMI and select the OS Reload link next to it
  • Select Reload from Image Template
  • Locate the docker enabled flex image to load on the BMI and select the Deploy Image link next to it
  • Complete the reload
  • Once your hourly BMI is reloaded it should have docker up and ready for you to use



Image certification

Prior to publishing these docker based image templates as "public" images in SoftLayer, the following due diligence is completed:
  • Provision a new instance from the docker based image.
  • Verify the instance boots and when it comes up that the docker daemon is running by default.
  • Perform the docker dev environment setup on the provisioned instance ensuring there are no errors. This is the suggested means to "bless" a docker infra / environment.
Once the above is completed successfully, the image is deemed ready for public consumption.


Support & disclaimer

The images described in this document are provided "as-is" without warranty. I cannot be responsible for any data loss, errors or otherwise unexpected issues as a result of their usage. Moreover these images are provided without any formal support by SoftLayer, IBM or affiliates. I will do my best to help with any issues which you can report as comments to this post or directly contact me.


Feedback

Your feedback is valued and greatly appreciated. Please contact me directly with your comments / feedback / wish-list or leave a comment on this page.


Related resources