doc-exports/docs/cce/umn/cce_bestpractice_0009.html
Dong, Qiu Jian 86fb05065f CCE UMN for 24.2.0 version -20240428
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2024-06-10 08:19:07 +00:00

25 lines
3.6 KiB
HTML

<a name="cce_bestpractice_0009"></a><a name="cce_bestpractice_0009"></a>
<h1 class="topictitle1">Building and Uploading an Image</h1>
<div id="body1513917418808"><p id="cce_bestpractice_0009__p14142101965116">This section describes how to build an entire application into a Docker image. After building an image, you can use the image to deploy and upgrade the application. This reduces manual configuration and improves efficiency.</p>
<div class="note" id="cce_bestpractice_0009__note13775132212511"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="cce_bestpractice_0009__p19776172211513">When building an image, ensure that files used to build the image are stored in the same directory.</p>
</div></div>
<div class="section" id="cce_bestpractice_0009__section18117257514"><h4 class="sectiontitle">Required Cloud Services</h4><p id="cce_bestpractice_0009__p105233334515">SoftWare Repository for Container (SWR) provides easy, secure, and reliable management over container images throughout their lifecycle, facilitating the deployment of containerized services.</p>
</div>
<div class="section" id="cce_bestpractice_0009__section11535414121813"><h4 class="sectiontitle">Basic Concepts</h4><ul id="cce_bestpractice_0009__ul155866715214"><li id="cce_bestpractice_0009__li65863710521">Image: A Docker image is a special file system that includes everything needed to run containers: programs, libraries, resources, settings, and so on. It also includes corresponding configuration parameters (such as anonymous volumes, environment variables, and users) required within a container runtime. An image does not contain any dynamic data, and its content remains unchanged after being built.</li><li id="cce_bestpractice_0009__li188759145210">Container: Images become containers at runtime, that is, containers are created from images. A container can be created, started, stopped, deleted, or suspended.</li></ul>
</div>
<div class="section" id="cce_bestpractice_0009__section66849244816"><h4 class="sectiontitle">Procedure</h4><ol id="cce_bestpractice_0009__ol572167134816"><li id="cce_bestpractice_0009__li1272116711480"><span>Log in as the <strong id="cce_bestpractice_0009__b1061612185127">root</strong> user to the device running Docker.</span></li><li id="cce_bestpractice_0009__li1419112894819"><span>Enter the <strong id="cce_bestpractice_0009__b11617111817123">apptest</strong> directory.</span><p><p id="cce_bestpractice_0009__p156915110210"><strong id="cce_bestpractice_0009__b1221818261732">cd apptest</strong></p>
<p id="cce_bestpractice_0009__p56739521729"><strong id="cce_bestpractice_0009__b22209266312">ll</strong></p>
<p id="cce_bestpractice_0009__p1467525318212">Ensure that files used to build the image are stored in the same directory.</p>
<p id="cce_bestpractice_0009__p209091014932"><span><img id="cce_bestpractice_0009__image16908101419319" src="en-us_image_0000001898023873.png"></span></p>
</p></li><li id="cce_bestpractice_0009__li13440153875210"><span>Build an image.</span><p><p id="cce_bestpractice_0009__p785619535521"><strong id="cce_bestpractice_0009__b659517574527">docker build -t apptest .</strong></p>
</p></li><li id="cce_bestpractice_0009__li1284619016533"><span>Upload the image to SWR. For details, see <a href="https://docs.otc.t-systems.com/usermanual/swr/swr_01_0011.html" target="_blank" rel="noopener noreferrer">Uploading an Image Through the Client</a>.</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_bestpractice_0340.html">Procedure</a></div>
</div>
</div>