dockerÔõôÉèÖþµÏñ¿ÍÕ»
ÉèÖà docker ¾µÏñ¿ÍÕ»µÄÁù¸öÒªº¦°ì·¨£ºÑ¡Ôñ¾µÏñ¿ÍÕ»½¨Éè¿ÍÕ»ÈÏÖ¤µ½¾µÏñ¿ÍÕ»ÍÆË;µÏñµ½¿ÍÕ»´Ó¿ÍÕ»ÀÈ¡¾µÏñÉèÖþµÏñ¿Íջƾ֤£¨¿ÉÑ¡£©
ÔõÑùÉèÖà Docker ¾µÏñ¿ÍÕ»
Docker ¾µÏñ¿ÍÕ»ÊÇ´æ´¢ºÍÖÎÀí Docker ¾µÏñµÄÖÐÑëλÖá£ÒªÉèÖà Docker ¾µÏñ¿ÍÕ»£¬¿ÉÒÔƾ֤ÒÔÏ°취¾ÙÐУº
1. Ñ¡Ôñ¾µÏñ¿ÍÕ»
Docker Hub£º¹«ÓоµÏñ¿ÍÕ»£¬Ä¬ÈÏÇéÐÎÏ´洢ÔÚ docker.io ÉÏ¡£
˽ÓоµÏñ¿ÍÕ»£ºÍйÜÔÚ×Ô¼ºµÄ»ù´¡ÉèÊ©»òµÚÈý·½Ð§ÀÍÌṩÉÌ´¦¡£
2. ½¨Éè¿ÍÕ»
Docker Hub£ºÖ±½ÓÔÚ Docker Hub ÍøÕ¾ÉϽ¨ÉèÕÊ»§²¢½¨Éè¿ÍÕ»¡£
˽ÓоµÏñ¿ÍÕ»£ºÊ¹Óà Docker Registry API »òµÚÈý·½¹¤¾ß£¨Èç Portainer »ò Harbor£©½¨Éè¿ÍÕ»¡£
3. ÈÏÖ¤µ½¾µÏñ¿ÍÕ»
Docker Hub£ºÊ¹Óà docker login ÏÂÁîµÇ¼µ½ Docker Hub¡£
˽ÓоµÏñ¿ÍÕ»£ºÆ¾Ö¤Ê¹ÓõľµÏñ¿ÍÕ»£¬Ê¹ÓÃÊʵ±µÄÈÏÖ¤ÒªÁ죨Èç OAuth2¡¢Óû§Ãû/ÃÜÂë»òÖ¤Ê飩¡£
4. ÍÆË;µÏñµ½¿ÍÕ»
ʹÓà docker push ÏÂÁÍâµØ¾µÏñÍÆË͵½¿ÍÕ»¡£Ó﷨Ϊ£º
docker push <registry>/<repo>/<image>[:<tag>]</tag></image></repo></registry>
µÇ¼ºó¸´ÖÆ
ÀýÈ磺
docker push docker.io/my-repo/my-image:latest
µÇ¼ºó¸´ÖÆ
5. ´Ó¿ÍÕ»ÀÈ¡¾µÏñ
ʹÓà docker pull ÏÂÁî´Ó¿ÍÕ»ÀÈ¡¾µÏñ¡£Ó﷨Ϊ£º
docker pull <registry>/<repo>/<image>[:<tag>]</tag></image></repo></registry>
µÇ¼ºó¸´ÖÆ
ÀýÈ磺
docker pull docker.io/library/nginx:latest
µÇ¼ºó¸´ÖÆ
6. ÉèÖþµÏñ¿Íջƾ֤£¨¿ÉÑ¡£©
ΪÁË×èֹÿ´ÎÍÆËÍ»òÀÈ¡¾µÏñʱ¶¼ÐèÒªÈÏÖ¤£¬¿ÉÒÔÉèÖþµÏñ¿Íջƾ֤¡£
ÔÚ Docker ¿Í»§¶ËÉèÖã¨~/.docker/config.json£©ÖÐÌí¼Óƾ֤£º
{ "auths": { "<registry>": { "auth": "<base64 encoded username:password>" } } }</base64></registry>
µÇ¼ºó¸´ÖÆ
ͨ¹ýÍê³ÉÕâЩ°ì·¨£¬¼´¿ÉÀÖ³ÉÉèÖà Docker ¾µÏñ¿ÍÕ»¡£Õ⽫ʹÄãÄܹ»´æ´¢¡¢ÖÎÀíºÍ¹²Ïí Docker ¾µÏñ£¬´Ó¶ø¼ò»¯ÈÝÆ÷»¯Ó¦ÓóÌÐòµÄ°²ÅÅ¡£
ÒÔÉϾÍÊÇdockerÔõôÉèÖþµÏñ¿ÍÕ»µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡