Updated on 2025-08-12 GMT+08:00

PostStart/PreStop Processing

Setting Container Lifecycle Parameters

CCI 2.0 provides containers with lifecycle hooks, which enable containers to run code triggered by events during their lifecycle. For example, if you want a container to perform a certain operation before it is stopped, you can register a hook. The following lifecycle hooks are provided:

  • PostStart: triggered immediately after the container is started
  • PreStop: triggered immediately before the container is stopped

CCI 2.0 supports only hook handlers of the Exec type, which execute a specific command.

  1. Log in to the CCI 2.0 console.
  1. On the Lifecycle tab, configure PostStart or PreStop.

    For example, if you want to run the /PostStart.sh all command in the container, configure data on the page shown in the following figure. The first row indicates the script name and the second row indicates a parameter setting.

    Figure 1 Command settings