尊龙凯时人生就是博

dockerÔõôÉèÖÃhost

Ϊ docker ÈÝÆ÷ÉèÖÃÖ÷»úÐèÐÞ¸ÄËÞÖ÷»úÉ쵀 /etc/hosts Îļþ£¬°ì·¨°üÀ¨£º1. È·¶¨Ä¿µÄÈÝÆ÷ ip µØµã £»2. ±à¼­ hosts Îļþ £»3. Ìí¼ÓÖ÷»ú¼Í¼¡£ÀýÈ磬½«ÈÝÆ÷ ip µØµã 172.17.0.2 ÉèÖÃΪÖ÷»úÃû my-host£¬ÔòÔÚ /etc/hosts ÎļþÖÐÌí¼Ó 172.17.0.2 my-host¡£

ÔÚ Docker ÖÐÉèÖÃÖ÷»ú

ÎÊÌ⣺ÔõÑùÔÚ Docker ÈÝÆ÷ÖÐÉèÖÃÖ÷»ú£¿

»Ø¸²£ºÎª Docker ÈÝÆ÷ÉèÖÃÖ÷»úÉæ¼°ÐÞ¸ÄËÞÖ÷»úÉ쵀 /etc/hosts Îļþ¡£

°ì·¨£º

È·¶¨Ä¿µÄÈÝÆ÷ IP µØµã£ºÔËÐÐ docker inspect my-container ÏÂÁÆäÖÐ my-container ÊÇÈÝÆ÷µÄÃû³Æ¡£ÔÚ “NetworkSettings” ²¿·ÖÏ£¬ÕÒµ½ÈÝÆ÷µÄ IPv4 µØµã¡£

±à¼­ hosts Îļþ£ºÊ¹ÓÃÎı¾±à¼­Æ÷£¨Èç nano »ò vi£©±à¼­ËÞÖ÷»úµÄ /etc/hosts Îļþ¡£

Ìí¼ÓÖ÷»ú¼Í¼£ºÔÚÎļþÖÐÌí¼ÓÒ»ÐУ¬ÃûÌÃΪ£º

 

µÇ¼ºó¸´ÖÆ

ÀýÈ磺

172.17.0.2 my-host

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÉúÑIJ¢Í˳ö hosts Îļþ¡£

ʾÀý£º

¼ÙÉèÄãÏ뽫ÈÝÆ÷ my-container µÄ IP µØµã 172.17.0.2 ÉèÖÃΪÖ÷»úÃû my-host£¬Äã¿ÉÒÔ×ñÕÕÒÔÏ°취£º

ÔËÐÐ docker inspect my-container ÏÂÁî²¢¼ÇÏ IP µØµã¡£

ʹÓà sudo nano /etc/hosts ·­¿ª /etc/hosts Îļþ¡£

Ìí¼ÓÒ»ÐУº

172.17.0.2 my-host

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

°´ Ctrl + X ÉúÑIJ¢Í˳öÎļþ¡£

ÏÖÔÚ£¬ÄãµÄ Docker ÈÝÆ÷¿ÉÒÔ»á¼ûÖ÷»úÃûΪ my-host µÄÖ÷»ú¡£

ÒÔÉϾÍÊÇdockerÔõôÉèÖÃhostµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ