Docker Container Redeploy

Note: This document is based on Jelastic version 4.6.

Once you have your Docker template deployed and properly configured, you receive a fully functional and stable application. However, the majority of Dockerized applications and services are continuously developed, delivering new product versions (implemented within tags) from time to time. Thus, most likely eventually you’ll need to update your already running template.

With Jelastic, this operation could be performed just in a few clicks, whilst providing the following benefits:
  • data, stored within the mounted to a container volumes, is saved and will remain available afterwards through being packed into separate .tar.gz archives, which are automatically transferred out/in the container to the host physical server during this operation
  • all the previously specified custom configurations (like run commands, links, variables, etc) won’t be affected
  • if operating with multiple template instances (i.e. in case it was scaled horizontally), the update can be performed implicitly and causing no downtime through redeploying the containers one by one

Docker update scheme

Update of the appropriate container with another tag version can be performed directly through the dashboard using GUI or remotely, with the help of Jelastic CLI client. So, let’s discover both of this options one-by-one.

Through Dashboard

The most clear and user-friendly way to update the template tag is to use Jelastic dashboard - the instruction below will walk you through the required steps:

1. The dedicated redeployment dialog frame can be accessed in two different ways:

  • select the Redeploy container(s)  button next to the required node (or next to the appropriate environment layer for updating all the comprised containers at once):

  • or, you can click on the Change environment topology button for your environment and then hit the pencil icon next to the tag version in the central part of the opened frame:

2. As a result, you’ll be shown the Redeploy containers frame, where you need to select the desired tag for the chosen container(s) to be updated with:

In case you’ve appointed to update several same-type nodes at once, the additional Sequential deployment option becomes available:

  • if set to On, it makes containers within the selected layer to be redeployed sequentially, i.e. one by one. In this case, running nodes will continue serving the incoming requests while a particular one is undergoing the update, in such a way ensuring your service availability during the procedure
  • if set to Off, all of the containers will be redeployed simultaneously, causing temporary downtime of your app (however, in this case the procedure itself will take less time)

After all the configurations are determined, just hit the Redeploy button.

3. Once the update is completed, you’ll see the corresponding pop-up message appeared in the top right corner of the dashboard:

Clicking the Show Logs button at it will lead you to the redeploy log tab, which contains the information on Node ID of the updated container(s), name:tag of the redeployed image and Duration of this process.

4. The current image tag version for every container can be seen within the Deployed column next to the appropriate Node ID record at the dashboard.

Through CLI Client

Another possible way to update Docker template tag is to use Jelastic CLI client, which provides the ability to accomplish all the required operations remotely.

Tip: In order to find out how the Jelastic CLI client can be installed and used in the most beneficial way for your environments’ and nodes’ remote management, refer to this instruction.

Once you’ve run the CLI client at your workstation, you are able to take the control over your Jelastic account via terminal. In our case, i.e. with an aim to perform the container(s) redeployment, the following actions are required:

1. Look for the available for template tag versions by executing the following command:

~/jelastic/environment/control/getdockertags --image {template_name} [--userName {login}] [--password {password}]

where {template_name} corresponds to the name of the required template, while {login} and {password} are optional parameters, required in case of a private repository usage.

2. Now, when you know the list of existing image tags, you can choose the one you need and initiate the container update - just run the next string:

~/jelastic/environment/control/redeploycontainerbyid --domain {env_domain} --nodeId {node_id} --tag {tag}

Here:

  • {env_domain} - the appropriate environment domain name
  • {node_id} - identifier of the container to be redeployed

    Note: You can get this ID right through the CLI client by examining the response of the appropriate ~/jelastic/environment/control/getenvinfo --domain {env_domain} command.
  • {tag} - image version the container will be updated with

Wait for a couple of minutes to see the method response with info on the versions the image was deployed from/to and duration of the operation itself.

Tip: Similar to the update via dashboard, you can redeploy all containers within the same environment layer at once using the corresponding CLI method:

~/jelastic/environment/control/redeploycontainersbygroup --domain {env_domain} --nodeGroup {group_id} --tag {tag}

Here, the {group_id} represents a node group identifier, which can be also observed using the command from the Note in the 2nd step.

In addition, you can enable the above described option of the sequential containers’ update through appending the corresponding [--sequential true] parameter to the executed command.

In such a way, with Jelastic you get a powerful tool for the Docker template tags’ management, being allowed to switch between them when needed with no manual adjustments or data transferring required.