Files
doc-exports/docs/swr/umn/swr_01_0017.html
qiujiandong1 1287ab0cee SWR UMN 20250710 version
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2025-10-29 10:46:14 +00:00

32 lines
7.1 KiB
HTML

<a name="swr_01_0017"></a><a name="swr_01_0017"></a>
<h1 class="topictitle1">Pulling an Image</h1>
<div id="body1591325400748"><div class="section" id="swr_01_0017__section165112517497"><h4 class="sectiontitle">Scenario</h4><p id="swr_01_0017__p642724817195">To use an image stored in a repository, you need to pull it from the repository first. Then, you can use this image to deploy containerized applications in CCE or CCI. Pulling an image is actually downloading an image.</p>
<p id="swr_01_0017__p1234318529125">You can use Docker or containerd to pull images from SWR.</p>
</div>
<div class="section" id="swr_01_0017__section13356144645616"><h4 class="sectiontitle">Docker</h4><ol id="swr_01_0017__en-us_topic_0084266454_ol1535723214147"><li id="swr_01_0017__li14636133352214"><span>Log in to the VM running Docker as the <strong id="swr_01_0017__b91611712121511">root</strong> user. </span></li><li id="swr_01_0017__li17667103735114"><span>Obtain a login command by referring to <a href="swr_01_0011.html#swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_li58001655123">1</a> and access SWR.</span></li><li id="swr_01_0017__li72341837102811"><span>Log in to the SWR console.</span></li><li id="swr_01_0017__en-us_topic_0084266454_li182568055016"><span>In the navigation pane, choose <strong id="swr_01_0017__b1086183519104">My Images</strong>. Then click the name of the target image.</span></li><li id="swr_01_0017__en-us_topic_0084266454_li197783469319"><a name="swr_01_0017__en-us_topic_0084266454_li197783469319"></a><a name="en-us_topic_0084266454_li197783469319"></a><span>On the image details page, click <span><img id="swr_01_0017__image1332211591861" src="en-us_image_0000002319087477.png"></span> next to the docker pull command on the <strong id="swr_01_0017__b16744303417">Pull/Push</strong> tab.</span></li><li id="swr_01_0017__li616511233439"><span>Replace <em id="swr_01_0017__i725851404311">{Tag}</em> in the image download command copied in <a href="#swr_01_0017__en-us_topic_0084266454_li197783469319">5</a> with the tag of the image to be downloaded and run the command on the VM.</span><p><p id="swr_01_0017__p111139327468">Run the <strong id="swr_01_0017__b63661044161">docker images</strong> command to check whether the images are successfully pulled.</p>
<pre class="screen" id="swr_01_0017__screen15419026204919"># docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
xxx/group/nginx v2.0.0 22f2bf2e2b4f 5 hours ago 22.8MB</pre>
</p></li><li id="swr_01_0017__li177891910121618"><span>(Optional) Run the following command to save the image as an archive file:</span><p><p id="swr_01_0017__p25393101487"><strong id="swr_01_0017__b19221436141915">docker save</strong> [<em id="swr_01_0017__i14925153651910">Image name:tag name</em>] <strong id="swr_01_0017__b15926636181919">&gt;</strong> [<em id="swr_01_0017__i1392612368198">Archive file name</em>]</p>
</p></li></ol>
</div>
<div class="section" id="swr_01_0017__section6393182517178"><h4 class="sectiontitle">containerd</h4><ol id="swr_01_0017__en-us_topic_0000001952079513_ol41721311435"><li id="swr_01_0017__en-us_topic_0000001952079513_li2852172504713"><span>Log in to the SWR console.</span></li><li id="swr_01_0017__en-us_topic_0000001952079513_li719274104316"><span>In the navigation pane, choose <strong id="swr_01_0017__b4916842101016">My Images</strong>. Then click the name of the target image.</span></li><li id="swr_01_0017__en-us_topic_0000001952079513_li16192124154316"><a name="swr_01_0017__en-us_topic_0000001952079513_li16192124154316"></a><a name="en-us_topic_0000001952079513_li16192124154316"></a><span>On the <strong id="swr_01_0017__b1353131184315">Tags</strong> tab, click <strong id="swr_01_0017__b735411118438">containerd command</strong> in the <strong id="swr_01_0017__b13354171119438">Operation</strong> column to copy the image pull command. Alternatively, go to the <strong id="swr_01_0017__b4354131114433">Pull/Push</strong> tab to copy the image pull command.</span><p><div class="note" id="swr_01_0017__en-us_topic_0000001952079513_note1785915817593"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="swr_01_0017__en-us_topic_0000001952079513_p18859125805916">The command is only valid for six hours after it is generated. To obtain a long-term valid command, see <a href="swr_01_1001.html">Obtaining a Long-Term Valid containerd Pull/Push Command</a>.</p>
</div></div>
</p></li><li id="swr_01_0017__en-us_topic_0000001952079513_li8227252164714"><span>Log in to the VM running containerd as the <strong id="swr_01_0017__b486685384114812">root</strong> user.</span></li><li id="swr_01_0017__en-us_topic_0000001952079513_li2851715134816"><span>Run the command copied in <a href="#swr_01_0017__en-us_topic_0000001952079513_li16192124154316">3</a>.</span><p><ul id="swr_01_0017__en-us_topic_0000001952079513_ul3357204210232"><li id="swr_01_0017__en-us_topic_0000001952079513_li735784213232">If the command was copied from the <strong id="swr_01_0017__b52637329924327">Operation</strong> column, run it as follows.<p id="swr_01_0017__en-us_topic_0000001952079513_p1937194615226"><span><img id="swr_01_0017__en-us_topic_0000001952079513_image133701746102218" src="en-us_image_0000002000854844.png"></span></p>
</li></ul>
<ul id="swr_01_0017__en-us_topic_0000001952079513_ul456114450239"><li id="swr_01_0017__en-us_topic_0000001952079513_li1556115458235">If the command was copied from the <strong id="swr_01_0017__b298217183911">Pull/Push</strong> tab, run it as follows. Change the organization name, image name, and tag to those of the image to be uploaded.<p id="swr_01_0017__en-us_topic_0000001952079513_p137115464227"><span><img id="swr_01_0017__en-us_topic_0000001952079513_image1237154692218" src="en-us_image_0000002037053129.png"></span></p>
</li></ul>
</p></li><li id="swr_01_0017__en-us_topic_0000001952079513_li2041611269466"><span>Check whether the image is pulled successfully.</span><p><ul id="swr_01_0017__en-us_topic_0000001952079513_ul1555314534710"><li id="swr_01_0017__en-us_topic_0000001952079513_li19587141264717">If the command was copied from the <strong id="swr_01_0017__b40896908824327">Operation</strong> column, run <strong id="swr_01_0017__b20262549424327">crictl images</strong> to check whether the pull is successful.<p id="swr_01_0017__en-us_topic_0000001952079513_p42592042112"><span><img id="swr_01_0017__en-us_topic_0000001952079513_image77329931317" src="en-us_image_0000002001013122.png"></span></p>
</li><li id="swr_01_0017__en-us_topic_0000001952079513_li1455355164715">If the command was copied from the <strong id="swr_01_0017__b52835053224327">Pull/Push</strong> tab, run <strong id="swr_01_0017__b12281959224327">ctr images list</strong> to check whether the pull is successful.<p id="swr_01_0017__en-us_topic_0000001952079513_p47528201616"><span><img id="swr_01_0017__en-us_topic_0000001952079513_image1731812303176" src="en-us_image_0000002037094013.png"></span></p>
</li></ul>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="swr_01_0028.html">Image Management</a></div>
</div>
</div>