Container Redeploy

CLI Tutorial: Container Redeploy

Use the platform CLI to redeploy a container from one image tag to another. You can update one specific container or redeploy an entire environment layer.

Identify the Environment and Container

First, identify the environment name and the node ID or environment-layer name of the container or containers that should be redeployed.

  • Review the required information in the platform dashboard.
  • Use the GetEnvs method to list environments.
  • Use the GetEnvInfo method to retrieve information about a particular environment.

The environment information includes layer names, node IDs, Docker images, active tags, and other topology details.

Keep the environment name, node-group identifier, node ID, current image name, and required target tag ready before starting the redeploy.

View Available Image Tags

After identifying the required node, use the following command to retrieve the tags available for its container image:

~/jelastic/environment/control/getcontainernodetags --envName {envName} --nodeId {nodeId}
{envName} Name of the environment containing the target container.
{nodeId} Identification number of the container whose image tags should be listed.

The command returns the image tags that can be selected for the redeploy operation.

Redeploy the Container

Use the redeploycontainers method after selecting the required image tag:

~/jelastic/environment/control/redeploycontainers --envName {envName} [--nodeGroup {nodeGroup}] [--nodeId {nodeId}] --tag {tag} [--useExistingVolumes {useExistingVolumes}] [--login {login}] [--password {password}]
Target requirement: Specify either nodeGroup or nodeId. When both are supplied, the method ignores nodeGroup. The command fails when neither target parameter is provided.

Redeploy Parameters

{envName} Name of the environment where the container or layer should be redeployed.
{nodeGroup} Identifier of the environment layer to update. This parameter is optional.
{nodeId} Identification number of a particular container to update. This parameter is optional.
{tag} Image version that should be deployed.
{useExistingVolumes} Set to true to preserve data stored in mounted volumes during redeploy. This parameter is optional.
{login} and {password} Credentials used to access an image in a private registry. These parameters are optional.

Check the Redeploy Result

The redeploy operation can take several minutes. A successful response includes:

  • "result": 0
  • The image version used before redeploy.
  • The image version applied after redeploy.
  • The update duration for each container.
After completion, verify that the application is running correctly with the selected image tag and that required volume data remains available.

What’s next?