forked from docs/doc-exports
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com> Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com> Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
62 lines
11 KiB
HTML
62 lines
11 KiB
HTML
<a name="swr_01_0011"></a><a name="swr_01_0011"></a>
|
|
|
|
<h1 class="topictitle1">Uploading an Image Through the Client</h1>
|
|
<div id="body1557200952787"><div class="section" id="swr_01_0011__section582103934115"><h4 class="sectiontitle">Scenario</h4><p id="swr_01_0011__en-us_topic_0083050718_p473620416297">This section walks you through the steps of uploading an image to SWR through the client by taking the <strong id="swr_01_0011__b296443213103">nginx:v1</strong> image built in <a href="swr_01_0006.html">Basics of the Container Engine</a> as an example. Uploading an image through the client is to run Docker commands on the client where Docker is installed to push the image to an image repository of SWR.</p>
|
|
</div>
|
|
<div class="section" id="swr_01_0011__section1577223318127"><h4 class="sectiontitle">Notes and Constraints</h4><ul id="swr_01_0011__ul5266946131218"><li id="swr_01_0011__li4266124615129">Each image layer uploaded through the client cannot exceed 10 GB.</li><li id="swr_01_0011__li1817924931213">The Docker client version must be 1.11.2 or later.</li></ul>
|
|
</div>
|
|
<div class="section" id="swr_01_0011__section115261275127"><h4 class="sectiontitle">Prerequisites</h4><ul id="swr_01_0011__ul19490738143214"><li id="swr_01_0011__li1490143811327">You have created an organization in SWR. For details, see <a href="swr_01_0014.html#swr_01_0014__section12921632181415">Creating an Organization</a>.</li><li id="swr_01_0011__li89952420187">If you use an ECS that is not a CCE node to connect to SWR using a private network address, configure <strong id="swr_01_0011__b141655413529">insecure-registries</strong> as follows:<ol id="swr_01_0011__ol1689492194"><li id="swr_01_0011__li968194921913">Modify the <span class="filepath" id="swr_01_0011__filepath19891112910366"><b>/etc/docker/daemon.json</b></span> file. If the file does not exist, manually create it. Add the following content to the file:<pre class="screen" id="swr_01_0011__screen6368134255419">{
|
|
"insecure-registries": [
|
|
"{<em id="swr_01_0011__i1161534114384">Intranet address</em>}"
|
|
]
|
|
}</pre>
|
|
<p id="swr_01_0011__p8956203182619">To obtain the value of {<em id="swr_01_0011__i14342185635312">Intranet address</em>}, log in to the SWR console. On the <strong id="swr_01_0011__b734215685315">Dashboard</strong> page, click <strong id="swr_01_0011__b1234215568536">Generate Login Command</strong> and obtain the private network address in the private network command.</p>
|
|
<div class="fignone" id="swr_01_0011__fig1384619914343"><span class="figcap"><b>Figure 1 </b>Obtaining the private network address</span><br><span><img id="swr_01_0011__image484699143414" src="en-us_image_0000001201043047.png" width="465.5" height="287.747628" title="Click to enlarge" class="imgResize"></span></div>
|
|
<div class="note" id="swr_01_0011__note4723191216403"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="swr_01_0011__p29859408426">If <strong id="swr_01_0011__b1735824265917">insecure-registry</strong> has been configured in the <strong id="swr_01_0011__b1493124515915">DOCKER_OPTS</strong> configuration item in the <span class="filepath" id="swr_01_0011__filepath62026105463"><b>/etc/default/docker</b></span> file, you do not need to modify the <span class="filepath" id="swr_01_0011__filepath42061724124414"><b>/etc/docker/daemon.json</b></span> file.</p>
|
|
<p id="swr_01_0011__p639815514441">Run the following command to add the private network IP address to the end of the <strong id="swr_01_0011__b13228132015016">DOCKER_OPTS</strong> configuration item:</p>
|
|
<p id="swr_01_0011__p71221025134512"><strong id="swr_01_0011__b596713013451">vi /etc/default/docker</strong></p>
|
|
<p id="swr_01_0011__p17331144119425">Example:</p>
|
|
<pre class="screen" id="swr_01_0011__screen187241512134020"># Use DOCKER_OPTS to modify the daemon startup options. DOCKER_OPTS="--insecure-registry={existing configurations} --insecure-registry={<em id="swr_01_0011__i1672451211402">Intranet address</em>}"</pre>
|
|
</div></div>
|
|
</li><li id="swr_01_0011__li20543102514017">Restart Docker for the configuration to take effect.<p id="swr_01_0011__p1054685204112"><a name="swr_01_0011__li20543102514017"></a><a name="li20543102514017"></a><strong id="swr_01_0011__b10264516194110">sudo systemctl daemon-reload</strong></p>
|
|
<p id="swr_01_0011__p1423231154114"><strong id="swr_01_0011__b026581610416">sudo systemctl restart docker</strong></p>
|
|
</li></ol>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="swr_01_0011__en-us_topic_0083050718_section862311112816"><h4 class="sectiontitle">Procedure</h4><ol id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_ol0471564418"><li id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_li58001655123"><a name="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_li58001655123"></a><a name="en-us_topic_0112596104_en-us_topic_0075378957_li58001655123"></a><span>Access SWR.</span><p><ol type="a" id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_ol48001255629"><li id="swr_01_0011__en-us_topic_0112596104_li20909134812497">Log in to the SWR console and the VM running the container engine as the <strong id="swr_01_0011__b1433105512515">root</strong> user. </li><li id="swr_01_0011__en-us_topic_0112596104_li182568055016"><a name="swr_01_0011__en-us_topic_0112596104_li182568055016"></a><a name="en-us_topic_0112596104_li182568055016"></a>In the navigation pane on the left, choose <span class="uicontrol" id="swr_01_0011__uicontrol195121454132813"><b>My Images</b></span> and then click <span class="uicontrol" id="swr_01_0011__uicontrol185181654152816"><b>Upload Through Client</b></span>. On the page displayed, click <span class="uicontrol" id="swr_01_0011__uicontrol3518195442815"><b>Generate <span id="swr_01_0011__text05181954132816">a temporary docker login</span> command</b></span> and click <span><img id="swr_01_0011__image18518165472812" src="en-us_image_0143894038.png"></span> to copy the command.<div class="fignone" id="swr_01_0011__en-us_topic_0112596104_fig157815441716"><span class="figcap"><b>Figure 2 </b>Obtaining a <strong id="swr_01_0011__b0357135883013">docker login</strong> command</span><br><span><img id="swr_01_0011__en-us_topic_0112596104_image167815441111" src="en-us_image_0000001200577091.png" width="438.90000000000003" height="35.956683000000005" title="Click to enlarge" class="imgResize"></span></div>
|
|
<div class="note" id="swr_01_0011__en-us_topic_0112596104_note1076410325569"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="swr_01_0011__ul29971410101415"><li id="swr_01_0011__li139971104147">A <span id="swr_01_0011__text12607623651">temporary login command</span> is valid for 24 hours. For details about how to obtain a login command that will remain valid for a long term, see <a href="swr_01_1000.html">Obtaining a Long-Term Valid Login Command</a>. After you obtain a long-term valid login command, your temporary login commands will still be valid as long as they are in their validity periods.</li><li id="swr_01_0011__li390920379147">The domain name at the end of the login command is the image repository address. Record the address for later use.</li></ul>
|
|
</div></div>
|
|
</li><li id="swr_01_0011__en-us_topic_0112596104_li16945102816563">Run the <strong id="swr_01_0011__b68132050102918">docker login</strong> command on your Docker client (a device that has Docker installed).<p id="swr_01_0011__en-us_topic_0112596104_p1890203810712">The message "Login Succeeded" will be displayed upon a successful login.</p>
|
|
</li></ol>
|
|
</p></li><li id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_li152356849"><span>Run the following command on the device where Docker is installed to label the <strong id="swr_01_0011__b17201820113010">nginx</strong> image:</span><p><p id="swr_01_0011__en-us_topic_0112596104_p163541257193816"><strong id="swr_01_0011__b41653471309">docker tag</strong> <em id="swr_01_0011__i3171194753020">[Image name 1</em>:<em id="swr_01_0011__i317154718306">tag 1]</em> <em id="swr_01_0011__i17171447153017">[Image repository address]</em>/<em id="swr_01_0011__i817114713309">[Organization name]</em>/<em id="swr_01_0011__i13172947163020">[Image name 2</em>:<em id="swr_01_0011__i21731447163019">tag 2]</em></p>
|
|
<p id="swr_01_0011__en-us_topic_0112596104_p944354613117">In the preceding command:</p>
|
|
<ul id="swr_01_0011__ul2511311124718"><li id="swr_01_0011__li10511191120477">[Image name 1:tag 1]: Replace it with the actual name and tag of the image to upload.</li><li id="swr_01_0011__li4953533194712">[Image repository address]: You can query the address on the SWR console, that is, the domain name at the end of the login command in <a href="#swr_01_0011__en-us_topic_0112596104_li182568055016">1.b</a>.</li><li id="swr_01_0011__li186518363511">[Organization name]: Replace it with the name of the organization created.</li><li id="swr_01_0011__li3633435105112">[Image name 2: tag 2]: Replace it with the desired image name and tag.</li></ul>
|
|
<p id="swr_01_0011__p137768714200">Example:</p>
|
|
<p id="swr_01_0011__p027419151243"><strong id="swr_01_0011__b17681119162411">docker tag nginx:v1 swr.eu-de.otc.t-systems.com/group/nginx:v1</strong></p>
|
|
</p></li><li id="swr_01_0011__en-us_topic_0112596104_li1337910433512"><span><span class="keyword" id="swr_01_0011__keyword234715327572">Push the image to the image repository</span> by running the following command:</span><p><p id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_p226420527123"><strong id="swr_01_0011__b8489155793518">docker push</strong> <em id="swr_01_0011__i3495195783516">[Image repository address]</em>/<em id="swr_01_0011__i1549545713354">[Organization name]</em>/<em id="swr_01_0011__i1649517571351">[Image name</em> 2:<em id="swr_01_0011__i204961572359">tag 2]</em></p>
|
|
<p id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_p51026157130">Example:</p>
|
|
<p id="swr_01_0011__p164472310305"><strong id="swr_01_0011__b044823193013">docker push swr.eu-de.otc.t-systems.com/group/nginx:v1</strong></p>
|
|
<p id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_p4521456842">The following information will be returned upon a successful push:</p>
|
|
<pre class="screen" id="swr_01_0011__en-us_topic_0112596104_en-us_topic_0075378957_screen3521456448">6d6b9812c8ae: Pushed
|
|
695da0025de6: Pushed
|
|
fe4c16cbf7a4: Pushed
|
|
v1: digest: sha256:eb7e3bbd8e3040efa71d9c2cacfa12a8e39c6b2ccd15eac12bdc49e0b66cee63 size: 948</pre>
|
|
<p id="swr_01_0011__en-us_topic_0112596104_p17380144320510">To view the pushed image, refresh the <span class="uicontrol" id="swr_01_0011__uicontrol6583131173919"><b>My Images</b></span> page.</p>
|
|
</p></li></ol>
|
|
</div>
|
|
<div class="section" id="swr_01_0011__section1992614317135"><p id="swr_01_0011__p20616131885818"></p>
|
|
</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>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
image_size('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |