Live Migration of Docker Containers within Cloud Regions

| January 14, 2016

According to IDC’s CloudView Survey, 57% of businesses are already using or plan to use different forms of cloud services, 44% use or plan to implement Private Cloud and 64% intent to integrate Hybrid Cloud. This creates a demand in the ability to move complex workloads between the clouds with high uptime and zero data loss. One of the ways to gain this and keep the applications running is to use containers live migration between different physical servers or even data centers.image05

Usually, you have to repack and rebuild containers with your workloads every time you are moving an application from one cloud or data center to another. The challenge, that needs overcoming here, is to make this migration maximally smooth and highly automated.

In this article, we’ll describe how some of the main DevOps issues can be solved leveraging the  live migration option and show the example of practical implementation of this solution.

Solution: Live Migration

Jelastic live migration is implemented through the container freeze at one set of hardware and restoring it on another one without downtime and data or incoming connections loss. Such zero downtime migration results in:

  • increased operational efficiency
  • optimization of load distribution across the cluster, which gives a better data center capacities utilization
  • allowing applications migration to more powerful infrastructure without service interruption
  • optimization of continuous integration and continuous delivery for Docker containers avoiding unnecessary environment rebuildings

In such a way, the ability to migrate containers provides DevOps teams with the more efficient flow of application lifecycle management. In Jelastic PaaS, with both live and offline migration of containers, you can easily transfer the application from one hardware region to another one with no need to rebuild the containers and redeploy the application.

Except that, customers can migrate their applications within different cloud vendors. This is ensured by the Jelastic Multi Cloud solution. Hosting providers and enterprises can mix Private and Public clouds within their data centers, even including external cloud vendors. Such an integration increases high availability, prevents data loss or unplanned downtime, improves performance and helps to optimize the costs.

How it works?

To perform live migration within the Jelastic Platform, just click on the region label next to your application (or, select Change environment topology and pick the Migrate option from the list at the top right of the appeared frame) and choose the preferred region in the opened tab.

Here, the Live migration option availability is indicated with the LM label next to the appropriate region name.image06

During the live migration, source application container is copied to the target server. Sure, there might be changes in the already copied memory pages during the migration process - in this case, such memory pages  are marked like modified for being re-copied. When only frequently changing pages in memory are left uncopied, container is freezed for a couple of seconds and activated on a new hardware node.

At the same time, all TCP connections are re-established at a new host with the help of the TCP repair mode in Linux kernel. It allows to keep the persistent connection for client-server applications, run on migrated containers, by means of re-announcing nodes’ IPs at a new destination host and restoring the previously established connections’ settings in a state they were handled before the migration to a destination server. The freeze takes a few seconds only, after which the target application resumes from the sources’ checkpoint (i.e. where it was freezed).

See It In Action

As an example, we’ll use SeisComP - a seismological software for data acquisition, processing and interactive analysis of earthquakes in real-time mode.

To easily deploy the above-mentioned tool, we’ll take the advantage of the tightly integrated Docker containers support in Jelastic.

1. Open Jelastic Environment Wizard with the New environment button in the upper left corner of the dashboard and switch to the Docker tab.
2. Select the unigeocloud/seiscomp container image within the appropriate frame (you can examine the Adding Docker Container to Jelastic Environment instruction in case you have any questions on this) and add it to the topology within the Application Server layer.image03

Next, define the resources limits for the container, choose the region your environment will be placed at (AWS in our case), give it a name and confirm the creation.

3. Now we can instantly run the application with the Open in browser button. Within the opened page, connect to its remote desktop using your credentials (you’ve received them via email earlier).

Launch the Seiscomp waveforms application, which visualizes the data, received from the preliminary defined seismic stations, in a form of graphs, allowing to monitor the seismological situation in a real-time.image00

4. Whilst the tracking is automatically performed in a background, switch back to the Jelastic dashboard and migrate your environment to another region (Azure in our case) by means of the corresponding tab at environment settings:image01

You can notice that our target region is marked with the green LM label - this means the Live migration option can be enabled with the corresponding switcher below, in order to relocate the chosen environment without downtime.

Click the Verify & Migrate button and confirm your decision to initiate the process.

5. Wait for the migration to be completed - you’ll receive the corresponding notification within the dashboard and email message with the new application data (e.g. IPs). The region label next to your environment will also be changed.image02
6. Herewith, during the relocation, the application continues working and stably obtains geodata packages.image04

As you can see, the graphs are constant and have no breakages. In such a way, you can ensure that live migration does not influent the work neither the environment nor the app inside, assuring its stable workability.

Network: In order to implement the currently presented solution, we’ve applied some additional pre-configurations to the Platform - namely, all of the regions were united under a common network to be accessible over a single entry point (Shared LB). This resulted in the ability to run an environment under the same domain name regardless of the selected hardware, so nothing should be additionally adjusted after relocation. Herewith, such an implementation implies that not a single node in an environment has the external IP address attached, as every region operates with its own pool of addresses.

You can also watch the video below to see all of the above-described operations in action:


As you can see, the importance of Live Migration cannot be overstated, as it gives the freedom of choice related to the price/performance/support parameters within different vendors and helps to avoid downtime for the majority of maintenance tasks. During live migration, applications keep working without downtime and get the required resources.

Register and try it yourself. Even more real use cases of migration within clouds can be seen in the following video:

  • Minecraft Live Migration without Downtime
  • Docker Container Live Migration from IBM Softlayer to Azure