Files
doc-exports/docs/ucs/umn/ucs_01_0148.html
qiujiandong1 0a674cd795 UCS UMN initial update 20250523 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2026-01-13 13:39:08 +00:00

200 lines
23 KiB
HTML

<a name="ucs_01_0148"></a><a name="ucs_01_0148"></a>
<h1 class="topictitle1">Setting Container Lifecycle Parameters</h1>
<div id="body8662426"><div class="section" id="ucs_01_0148__en-us_topic_0000001243981079_section196471258364"><h4 class="sectiontitle">Scenario</h4><p id="ucs_01_0148__en-us_topic_0000001243981079_p182561527714">UCS provides callback functions (hooks) for the lifecycle management of containerized applications. For example, if you want a container to perform a certain operation before stopping, you can register a hook.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p152208151978">UCS provides the following lifecycle callback functions:</p>
<ul id="ucs_01_0148__en-us_topic_0000001243981079_ul922021513717"><li id="ucs_01_0148__en-us_topic_0000001243981079_li16220815773"><strong id="ucs_01_0148__b15350154011286"><span class="keyword" id="ucs_01_0148__keyword334364015288">Startup Command</span></strong>: executed to start a container. For details, see <a href="#ucs_01_0148__en-us_topic_0000001243981079_section54912655316">Startup Commands</a>.</li><li id="ucs_01_0148__en-us_topic_0000001243981079_li14220201518713"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b150302499794538"><span class="keyword" id="ucs_01_0148__en-us_topic_0000001243981079_keyword29571762817312">Post-Start</span></strong>: executed immediately after a container is started. For details, see <a href="#ucs_01_0148__en-us_topic_0000001243981079_section15243544163715">Post-Start Processing</a>.</li><li id="ucs_01_0148__en-us_topic_0000001243981079_li32206153712"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b162512053994533"><span class="keyword" id="ucs_01_0148__en-us_topic_0000001243981079_keyword26075130317328">Pre-Stop</span></strong>: executed before a container is stopped. The pre-stop processing function helps you ensure that the services running on the pods can be completed in advance in the case of pod upgrade or deletion. For details, see <a href="#ucs_01_0148__en-us_topic_0000001243981079_section2334114473712">Pre-Stop Processing</a>.</li></ul>
</div>
<div class="section" id="ucs_01_0148__en-us_topic_0000001243981079_section54912655316"><a name="ucs_01_0148__en-us_topic_0000001243981079_section54912655316"></a><a name="en-us_topic_0000001243981079_section54912655316"></a><h4 class="sectiontitle">Startup Commands</h4><p id="ucs_01_0148__en-us_topic_0000001243981079_p198271342105918">By default, the default command during image start. To run a specific command or rewrite the default image value, you must perform specific settings:</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p1639559153012">A Docker image has metadata that stores image information. If lifecycle commands and arguments are not set, UCS runs the default commands and arguments (Docker instructions <strong id="ucs_01_0148__b178607518257">ENTRYPOINT</strong> and <strong id="ucs_01_0148__b208601151172512">CMD</strong>) provided during image creation.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p20395798303">If the commands and arguments used to run a container are set during application creation, the default commands <strong id="ucs_01_0148__en-us_topic_0000001243981079_b125702255322">ENTRYPOINT</strong> and <strong id="ucs_01_0148__en-us_topic_0000001243981079_b105781025143210">CMD</strong> are overwritten during image build. The rules are as follows:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ucs_01_0148__en-us_topic_0000001243981079_table1239514916307" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Commands and arguments used to run a container</caption><thead align="left"><tr id="ucs_01_0148__en-us_topic_0000001243981079_row123961993020"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.5.2.6.1.1"><p id="ucs_01_0148__en-us_topic_0000001243981079_p173964919308">Image ENTRYPOINT</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.5.2.6.1.2"><p id="ucs_01_0148__en-us_topic_0000001243981079_p143962963013">Image CMD</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.5.2.6.1.3"><p id="ucs_01_0148__en-us_topic_0000001243981079_p113961193307">Command to Run a Container</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.5.2.6.1.4"><p id="ucs_01_0148__en-us_topic_0000001243981079_p939611911308">Parameters to Run a Container</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.5.2.6.1.5"><p id="ucs_01_0148__en-us_topic_0000001243981079_p539617913304">Command Executed</p>
</th>
</tr>
</thead>
<tbody><tr id="ucs_01_0148__en-us_topic_0000001243981079_row8396149113019"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p1239610910302">[touch]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p6396189193016">[/root/test]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.3 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p153961891301">Not set</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.4 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p0396189143012">Not set</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.5 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p183962919306">[touch /root/test]</p>
</td>
</tr>
<tr id="ucs_01_0148__en-us_topic_0000001243981079_row103966913014"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p539617910301">[touch]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p123962973012">[/root/test]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.3 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p839619973012">[mkdir]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.4 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p2396109133019">Not set</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.5 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p239616923012">[mkdir]</p>
</td>
</tr>
<tr id="ucs_01_0148__en-us_topic_0000001243981079_row639679173014"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p20396795305">[touch]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p193962943010">[/root/test]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.3 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p7396696301">Not set</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.4 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p1239615943016">[/opt/test]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.5 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p1939639143020">[touch /opt/test]</p>
</td>
</tr>
<tr id="ucs_01_0148__en-us_topic_0000001243981079_row11396159113013"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p13969914304">[touch]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p43962097306">[/root/test]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.3 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p15396693306">[mkdir]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.4 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p73963953014">[/opt/test]</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.5.2.6.1.5 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p0396129193013">[mkdir /opt/test]</p>
</td>
</tr>
</tbody>
</table>
</div>
<ol id="ucs_01_0148__en-us_topic_0000001243981079_ol4904646935"><li id="ucs_01_0148__en-us_topic_0000001243981079_li190412461831"><span>When creating a workload, select <strong id="ucs_01_0148__b207911312172019">Lifecycle</strong> under <strong id="ucs_01_0148__b157911612132012">Container Settings</strong>.</span></li><li id="ucs_01_0148__en-us_topic_0000001243981079_li1060727152219"><span>Enter a command and arguments on the <span class="uicontrol" id="ucs_01_0148__en-us_topic_0000001243981079_uicontrol1273152913717"><b>Startup Command</b></span> tab page.</span><p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ucs_01_0148__en-us_topic_0000001243981079_table15533234825" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Container startup commands</caption><thead align="left"><tr id="ucs_01_0148__en-us_topic_0000001243981079_row85331634326"><th align="left" class="cellrowborder" valign="top" width="28.999999999999996%" id="mcps1.3.2.6.2.2.1.2.3.1.1"><p id="ucs_01_0148__en-us_topic_0000001243981079_p18442342527">Configuration Item</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="71%" id="mcps1.3.2.6.2.2.1.2.3.1.2"><p id="ucs_01_0148__en-us_topic_0000001243981079_p1444519421210">Procedure</p>
</th>
</tr>
</thead>
<tbody><tr id="ucs_01_0148__en-us_topic_0000001243981079_row65339348218"><td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.3.2.6.2.2.1.2.3.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p353573415215">Command</p>
</td>
<td class="cellrowborder" valign="top" width="71%" headers="mcps1.3.2.6.2.2.1.2.3.1.2 "><p id="ucs_01_0148__p455516455315">Run a specified command in the container using either the bash or binary mode. You can configure the command by referring to the example.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p2595134133217">If there are multiple commands, separate them with spaces. If the command contains a space, you need to add a quotation mark ("").</p>
<div class="note" id="ucs_01_0148__en-us_topic_0000001243981079_note11952193619513"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="ucs_01_0148__en-us_topic_0000001243981079_p1795213665120">In the case of multiple commands, you are advised to run <strong id="ucs_01_0148__en-us_topic_0000001243981079_b10788153303513">/bin/sh</strong> or other <strong id="ucs_01_0148__en-us_topic_0000001243981079_b67943339350">shell</strong> commands. Other commands are used as parameters.</p>
</div></div>
</td>
</tr>
<tr id="ucs_01_0148__en-us_topic_0000001243981079_row85351342022"><td class="cellrowborder" valign="top" width="28.999999999999996%" headers="mcps1.3.2.6.2.2.1.2.3.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p165351342212">Args</p>
</td>
<td class="cellrowborder" valign="top" width="71%" headers="mcps1.3.2.6.2.2.1.2.3.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p74728683919">Enter the argument that controls the container running command, for example, <strong id="ucs_01_0148__en-us_topic_0000001243981079_b238010399358">--port=8080</strong>.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p10535163420216">If there are multiple arguments, separate them in different lines.</p>
</td>
</tr>
</tbody>
</table>
</div>
</p></li></ol>
</div>
<div class="section" id="ucs_01_0148__en-us_topic_0000001243981079_section15243544163715"><a name="ucs_01_0148__en-us_topic_0000001243981079_section15243544163715"></a><a name="en-us_topic_0000001243981079_section15243544163715"></a><h4 class="sectiontitle">Post-Start Processing</h4><ol id="ucs_01_0148__en-us_topic_0000001243981079_ol11752171183813"><li id="ucs_01_0148__en-us_topic_0000001243981079_li731810111761"><span>When creating a workload, select <strong id="ucs_01_0148__b383122942014">Lifecycle</strong> under <strong id="ucs_01_0148__b1183112294200">Container Settings</strong>.</span></li><li id="ucs_01_0148__en-us_topic_0000001243981079_li1275610116383"><span>Set the post-start processing parameters on the <span class="uicontrol" id="ucs_01_0148__en-us_topic_0000001243981079_uicontrol1897714362"><b>Post-Start</b></span> tab page.</span><p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ucs_01_0148__en-us_topic_0000001243981079_table823614643810" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Post-start processing parameters</caption><thead align="left"><tr id="ucs_01_0148__en-us_topic_0000001243981079_row182422468384"><th align="left" class="cellrowborder" valign="top" width="23%" id="mcps1.3.3.2.2.2.1.2.3.1.1"><p id="ucs_01_0148__en-us_topic_0000001243981079_p122437460382">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="77%" id="mcps1.3.3.2.2.2.1.2.3.1.2"><p id="ucs_01_0148__en-us_topic_0000001243981079_p1924524616384">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="ucs_01_0148__en-us_topic_0000001243981079_row102472046183820"><td class="cellrowborder" valign="top" width="23%" headers="mcps1.3.3.2.2.2.1.2.3.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p1248204618385">CLI</p>
</td>
<td class="cellrowborder" valign="top" width="77%" headers="mcps1.3.3.2.2.2.1.2.3.1.2 "><p id="ucs_01_0148__p1049862714532">Run a specified command in the container using either the bash or binary mode. You can configure the command by referring to the example.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p8249134611380">The command format is <strong id="ucs_01_0148__en-us_topic_0000001243981079_b842352706152442">Command Args[1] Args[2]...</strong>. <strong id="ucs_01_0148__en-us_topic_0000001243981079_b84235270615253">Command</strong> is a system command or a user-defined executable program. If no path is specified, an executable program in the default path will be selected. If multiple commands need to be executed, write the commands into a script for execution. <strong id="ucs_01_0148__b4998165155712">Commands that are executed in the background or asynchronously are not supported.</strong></p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p32497468380">Example command:</p>
<pre class="screen" id="ucs_01_0148__en-us_topic_0000001243981079_screen15250164673811">exec:
command:
- /install.sh
- install_agent</pre>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p92541146123820">Enter <strong id="ucs_01_0148__en-us_topic_0000001243981079_b842352706152826">/install install_agent</strong> in the script. This command indicates that <strong id="ucs_01_0148__en-us_topic_0000001243981079_b11811112419471">install.sh</strong> will be executed after the container is created successfully.</p>
</td>
</tr>
<tr id="ucs_01_0148__en-us_topic_0000001243981079_row925519462389"><td class="cellrowborder" valign="top" width="23%" headers="mcps1.3.3.2.2.2.1.2.3.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p1261104603816">HTTP request</p>
</td>
<td class="cellrowborder" valign="top" width="77%" headers="mcps1.3.3.2.2.2.1.2.3.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p162625461389">Send an HTTP request for post-start processing. The related parameters are described as follows:</p>
<ul id="ucs_01_0148__en-us_topic_0000001243981079_ul426364613385"><li id="ucs_01_0148__en-us_topic_0000001243981079_li1126311461385"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b8207132175211">Path</strong>: (optional) request URL.</li><li id="ucs_01_0148__en-us_topic_0000001243981079_li12641946173820"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b1099715385217">Port</strong>: (mandatory) request port.</li><li id="ucs_01_0148__en-us_topic_0000001243981079_li726644612387"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b97156610528">Host</strong>: (optional) IP address of the request. The default value is the IP address of the node where the container resides.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</p></li></ol>
</div>
<div class="section" id="ucs_01_0148__en-us_topic_0000001243981079_section2334114473712"><a name="ucs_01_0148__en-us_topic_0000001243981079_section2334114473712"></a><a name="en-us_topic_0000001243981079_section2334114473712"></a><h4 class="sectiontitle">Pre-Stop Processing</h4><ol id="ucs_01_0148__en-us_topic_0000001243981079_ol4798215404"><li id="ucs_01_0148__en-us_topic_0000001243981079_li13981850166"><span>When creating a workload, select <strong id="ucs_01_0148__b13833162916208">Lifecycle</strong> under <strong id="ucs_01_0148__b883362916203">Container Settings</strong>.</span></li><li id="ucs_01_0148__en-us_topic_0000001243981079_li128087114016"><span>Set the pre-start processing parameters on the <span class="uicontrol" id="ucs_01_0148__en-us_topic_0000001243981079_uicontrol1888454618416"><b>Pre-Stop</b></span> tab page.</span><p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="ucs_01_0148__en-us_topic_0000001243981079_table1541840142714" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Pre-stop processing parameters</caption><thead align="left"><tr id="ucs_01_0148__en-us_topic_0000001243981079_row18419601274"><th align="left" class="cellrowborder" valign="top" width="23%" id="mcps1.3.4.2.2.2.1.2.3.1.1"><p id="ucs_01_0148__en-us_topic_0000001243981079_p12419130182714">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="77%" id="mcps1.3.4.2.2.2.1.2.3.1.2"><p id="ucs_01_0148__en-us_topic_0000001243981079_p1441913013274">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="ucs_01_0148__en-us_topic_0000001243981079_row04201302279"><td class="cellrowborder" valign="top" width="23%" headers="mcps1.3.4.2.2.2.1.2.3.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p6420110192718">CLI</p>
</td>
<td class="cellrowborder" valign="top" width="77%" headers="mcps1.3.4.2.2.2.1.2.3.1.2 "><p id="ucs_01_0148__p71921415506">Run a specified command in the container using either the bash or binary mode. You can configure the command by referring to the example.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p94204010271">The command format is <strong id="ucs_01_0148__b2055498740">Command Args[1] Args[2]...</strong>. <strong id="ucs_01_0148__b818576054">Command</strong> is a system command or a user-defined executable program. If no path is specified, an executable program in the default path will be selected. If multiple commands need to be executed, write the commands into a script for execution.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p94203082712">Example command:</p>
<pre class="screen" id="ucs_01_0148__en-us_topic_0000001243981079_screen6420190132712">exec:
command:
- /uninstall.sh
- uninstall_agent</pre>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p742120182716">Enter <strong id="ucs_01_0148__en-us_topic_0000001243981079_b103722545816">/uninstall uninstall_agent</strong> in the script. This command indicates that the <strong id="ucs_01_0148__en-us_topic_0000001243981079_b19674026155910">uninstall.sh</strong> script will be executed before the container completes its execution and stops running.</p>
</td>
</tr>
<tr id="ucs_01_0148__en-us_topic_0000001243981079_row4421190152715"><td class="cellrowborder" valign="top" width="23%" headers="mcps1.3.4.2.2.2.1.2.3.1.1 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p154216032719">HTTP request</p>
</td>
<td class="cellrowborder" valign="top" width="77%" headers="mcps1.3.4.2.2.2.1.2.3.1.2 "><p id="ucs_01_0148__en-us_topic_0000001243981079_p15421160122715">Send an HTTP request for pre-stop processing. The related parameters are described as follows:</p>
<ul id="ucs_01_0148__en-us_topic_0000001243981079_ul204215052713"><li id="ucs_01_0148__en-us_topic_0000001243981079_li124214052715"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b198341981321">Path</strong>: (optional) request URL.</li><li id="ucs_01_0148__en-us_topic_0000001243981079_li104211303275"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b684213101329">Port</strong>: (mandatory) request port.</li><li id="ucs_01_0148__en-us_topic_0000001243981079_li164227011277"><strong id="ucs_01_0148__en-us_topic_0000001243981079_b1681213521">Host</strong>: (optional) IP address of the request. The default value is the IP address of the node where the container resides.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</p></li></ol>
</div>
<div class="section" id="ucs_01_0148__en-us_topic_0000001243981079_section151181981167"><h4 class="sectiontitle">YAML Example</h4><p id="ucs_01_0148__en-us_topic_0000001243981079_p13147194016468">This section uses Nginx as an example to describe how to set the container lifecycle.</p>
<p id="ucs_01_0148__en-us_topic_0000001243981079_p15279185820">In the following configuration file, the <strong id="ucs_01_0148__en-us_topic_0000001243981079_b964310018294">postStart</strong> command is defined to run the <strong id="ucs_01_0148__en-us_topic_0000001243981079_b9643602292">install.sh</strong> command in the <strong id="ucs_01_0148__en-us_topic_0000001243981079_b18643180192920">/bin/bash</strong> directory. <strong id="ucs_01_0148__en-us_topic_0000001243981079_b1464330152911">preStop</strong> is defined to run the <strong id="ucs_01_0148__en-us_topic_0000001243981079_b46435072919">uninstall.sh</strong> command.</p>
<pre class="screen" id="ucs_01_0148__en-us_topic_0000001243981079_screen8529181815811">apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b2557141820811"> command:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b602760589517"> - sleep 3600</strong> <strong id="ucs_01_0148__en-us_topic_0000001243981079_b557238559517"> #Startup command</strong>
imagePullPolicy: Always
lifecycle:
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b356919181282"> postStart:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b05719181388"> exec:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b657619181180"> command:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b157817184810"> - /bin/bash</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b5984012195132"> - install.sh</strong> <strong id="ucs_01_0148__en-us_topic_0000001243981079_b737670595132"> #Post-start command</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b175988181287"> preStop:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b360111181288"> exec:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b360516183814"> command:</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b14607718384"> - /bin/bash</strong>
<strong id="ucs_01_0148__en-us_topic_0000001243981079_b110644295144"> - uninstall.sh</strong> <strong id="ucs_01_0148__en-us_topic_0000001243981079_b556114495144"> #<strong id="ucs_01_0148__en-us_topic_0000001243981079_b815245295144">Pre-stop command</strong></strong>
name: nginx
imagePullSecrets:
- name: default-secret</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="ucs_01_0105.html">Workload Management</a></div>
</div>
</div>