Redeploying Containers with the CLI
This guide provides the procedure to redeploy a container with a different image tag and, optionally, redeploy it with all the layers.
Prerequisites:
Make sure you have installed Platform CLI on your local machine. (Ref: Platform CLI) In this context, the word “container” means application node.
Step 1: Get Environment and Container Information
First, get the name of the environment and the ID of the node or layer of the container to be used in its redeployment. This can be done via the dashboard or by issuing directly from the terminal the methods GetEnvs and GetEnvInfo to get data on all or a specific environment.
- GetEnvs (will list all the available environments list):
Example:
~/elastic/environment/control/getenvs | grep envName
- GetEnvInfo (will give details of given envName):
Command:
~/elastic/environment/control/getenvinfo --envname {envName}
Example:
~/elastic/environment/control/getenvinfo --envname accu-api
Step 2: Fetch Available Tags (that will be available versions)
With the container’s ID and layer (node group name) at hand, view the available tags for the image using the GetContainerNodeTags method. Pass the environment name and node id (it will be an id field under node key in the json response) as parameters.
Command:
~/jelastic/environment/control/getcontainernodetags --envName {envName} --nodeId {nodeId}
Example:
~/jelastic/environment/control/getcontainernodetags --envName accu-api --nodeId 5333
This command will list all tags for the specified node.
Step 3: Redeploy the Container
Redeploy a container via CLI using the command given below by providing relevant parameters to the RedeployContainers method:
Command:
~/elastic/environment/control/redeploycontainers --envName {envName} [--nodeGroup {nodeGroup}] [--nodeId {nodeId}] --tag {tag} [--useExistingVolumes {useExistingVolumes}] [--login {login}] [--password {password}]
Example:
~/elastic/environment/control/redeploycontainers --envName accu-api --nodeGroup cp --nodeId 5333 --tag 2.4.58-php-8.3.4-almalinux-9 --useExistingVolumes true
Parameters:
- envName: The name of the environment where the container(s) is present.
- nodeGroup: Identifier of the environment layer to update (optional).
- nodeId: ID of the specific container to redeploy (optional). Note that either nodeGroup or nodeId must be provided.
- tag: The image version to be deployed.
- useExistingVolumes: Set to true to retain data in mounted volumes within the updated container(s) (optional).
- login and password: Credentials for accessing an image from a private registry (optional).
The process might take a few minutes and should conclude with a “result”: 0 indicating success. The response will include the versions before and after the redeployment and the duration of each container’s update.



