dockerÔõôִÐÐhostÏÂÁî
ÔÚ docker ÈÝÆ÷ÖÐÖ´ÐÐ host ÏÂÁîÓÐÁ½ÖÖÒªÁ죺ʹÓÃÌØȨÈÝÆ÷£¬ÔÚÔËÐÐ docker run ÏÂÁîʱÌí¼Ó –privileged ±ê¼Ç¡£½«Ö÷»úÍøÂçÃüÃû¿Õ¼ä°ó¶¨µ½ÈÝÆ÷£¬ÔÚÔËÐÐ docker run ÏÂÁîʱÌí¼Ó –net=host ±ê¼Ç¡£
ÔõÑùÔÚ Docker ÖÐÖ´ÐÐ host ÏÂÁî
ÔÚ Docker ÈÝÆ÷ÖУ¬Ä¬ÈÏÇéÐÎÏÂÎÞ·¨Ö±½ÓÖ´ÐÐ host ÏÂÁΪÁËÖ´ÐÐ host ÏÂÁÐèҪʹÓÃÌØȨÈÝÆ÷»ò°ó¶¨Ö÷»úÉϵÄÍøÂçÃüÃû¿Õ¼ä¡£
ʹÓÃÌØȨÈÝÆ÷
×î¼òÆÓµÄÒªÁìÊÇÔËÐÐÒ»¸ö¾ßÓÐÌØȨȨÏÞµÄÈÝÆ÷¡£Îª´Ë£¬ÔÚÔËÐÐ docker run ÏÂÁîʱÌí¼Ó –privileged ±ê¼Ç£º
docker run --privileged -it debian bash
µÇ¼ºó¸´ÖÆ
ÔÚÌØȨÈÝÆ÷ÖУ¬ÏÖÔÚ¿ÉÒÔÖ´ÐÐ host ÏÂÁ
host google.com
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
°ó¶¨Ö÷»úÍøÂçÃüÃû¿Õ¼ä
ÁíÒ»ÖÖÒªÁìÊǽ«Ö÷»úÉϵÄÍøÂçÃüÃû¿Õ¼ä°ó¶¨µ½ÈÝÆ÷¡£Îª´Ë£¬ÔÚÔËÐÐ docker run ÏÂÁîʱÌí¼Ó –net=host ±ê¼Ç£º
docker run --net=host -it debian bash
µÇ¼ºó¸´ÖÆ
ÓëÌØȨÈÝÆ÷ÀàËÆ£¬ÏÖÔÚ¿ÉÒÔÔÚ°ó¶¨ÍøÂçÃüÃû¿Õ¼äµÄÈÝÆ÷ÖÐÖ´ÐÐ host ÏÂÁ
host google.com
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÐèҪעÖصÄÊÇ£¬Ê¹Óà –net=host Ñ¡Ïîʱ£¬ÈÝÆ÷½«ÓëÖ÷»ú¹²ÏíÏàͬµÄÍøÂçÃüÃû¿Õ¼ä¡£ÕâÒâζ×ÅÈÝÆ÷½«Äܹ»»á¼ûÓëÖ÷»úÏàͬµÄÍøÂç×ÊÔ´¡£Õâ¿ÉÄÜ»á´øÀ´Ç徲Σº¦£¬Òò´Ë½öÔÚ¾ø¶ÔÐëҪʱ²ÅʹÓôËÑ¡Ïî¡£
ÒÔÉϾÍÊÇdockerÔõôִÐÐhostÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡