Deploying Docker containers using deployment REST APIs
You can deploy Liberty or Node.js servers in Docker containers as members of a collective by using the DeployService REST APIs.
Before you begin
Stabilized feature: Managing
Docker containers by using Liberty
collectives is stabilized. For managing Docker containers, run your Liberty applications in IBM®
Cloud Pak for Applications for on-premises or bring-your-own infrastructure. For hosted
environments, use Docker containers in IBM Cloud® Kubernetes Service.
Determine the target hosts onto which you want to install a Docker image. Install Docker on the target hosts. Each target host needs RXA or SSH. See Setting up RXA for Liberty collective operations.
If you will use Node.js in a Docker container, download a Node.js 4.x version from the Docker Hub registry.
Watch: The Managing an On-Premise, Polyglot Environment with WebSphere® Liberty Collectives video.
Procedure
What to do next
Request and review the deployment status and results.
- Get a list of tokens for requested deployment
operations.
GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/deploy
- Get a short status of the deployment operations. Use the token from step 4 for
{token}
. Thus, for a{"id":3}
return token from step 4, use3
for{token}
.
During deployment, the API returns IN_PROGRESS:GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/{token}/status
After deployment, the API returns FINISHED:{"status":{"target_host":"IN_PROGRESS"}}
{"status":{"target_host":"FINISHED"}}
- Get the complete results of a deployment operation. Use the token from step 4 for
{token}
. Thus, for a{"id":3}
return token from step 4, use3
for{token}
.
After deployment completes, the results contain information about the operation. The following example shows results for FINISHED:GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/{token}/results
{"results":[{"host_name":"target_host","status":"FINISHED","result":0}]}
Undeploy a Docker container. You do not need to specify a deploy rule. The rule used for
deployment was stored at deploy time. You can use the rule for undeployment. The
userDir variable must be
Docker
.- Undeploy a
container.
POST https://controller_host:controller_port/ibm/api/collective/v1/deployment/undeploy { "host": "myHostName", "userDir":"Docker", "serverName":"myContainerName" }
- Get a list of tokens for undeployment
operations.
To get status and results, follow steps similar to deployments.GET https://controller_host:controller_port/ibm/api/collective/v1/deployment/undeploy