dockerÍøÂç³åÍ»Ôõô°ì
docker ÍøÂç³åÍ»¿Éͨ¹ýÒÔÏÂÒªÁì½â¾ö£º½¨Éè×Ô½ç˵ docker ÍøÂç²¢½«Æä·ÖÅɸøÏà¹ØÈÝÆ÷¡£½«ÈÝÆ÷ÉèÖÃΪʹÓÃÇŽÓģʽ£¬ÒÔ±ã»ñȡΨһµÄ ip µØµã¡£½«ÈÝÆ÷¶Ë¿ÚÓ³Éäµ½Ö÷»ú¶Ë¿Ú£¬ÒÔ×èÖ¹¶Ë¿Ú³åÍ»¡£ÉèÖö˿ڹæÄ££¬ÒÔ±ãÔÚÔËÐÐʱ×Ô¶¯·ÖÅɶ˿ڡ£ÔÚ docker ÍøÂçÖн¨Éè×ÓÍø£¬ÎªÈÝÆ÷Ìṩ¸ü´óµÄ ip µØµã¹æÄ£¡£Ê¹ÓÃÈÝÆ÷Ãû³ÆÆÊÎö£¬Ê¹ÈÝÆ÷Äܹ»Ê¹ÓÃÏ໥µÄÃû³ÆͨѶ¡£Ê¹Óà docker compose ʱ£¬Ê¹Óà network_mode: bridge Ñ¡ÏîÀ´±ÜÃâ³åÍ»¡£²Î¿¼¹Ù·½ docker ÎĵµÒÔ»ñÈ¡¸üÏêϸµÄÖ¸µ¼¡£
Docker ÍøÂç³åÍ»½â¾ö¼Æ»®
ÎÊÌ⣺ÔõÑù½â¾ö Docker ÍøÂç³åÍ»£¿
½â¾ö¼Æ»®£º
Docker ÍøÂç³åͻͨ³£±¬·¢ÔÚ¶à¸öÈÝÆ÷ʵÑéʹÓÃͳһ IP µØµã»ò¶Ë¿Úʱ¡£½â¾ö´ËÎÊÌâµÄ³£¼ûÒªÁìÈçÏ£º
1. ʹÓÃ×Ô½ç˵ÍøÂ磺
½¨Éè×Ô½ç˵ Docker ÍøÂç²¢½«Æä·ÖÅɸøÏà¹ØµÄÈÝÆ÷£¬ÒÔ¸ôÀëËüÃDz¢±ÜÃâ³åÍ»¡£Ê¹Óà docker network create ÏÂÁÉèÍøÂ磬ȻºóʹÓà docker run –net Ñ¡ÏÈÝÆ÷ÅþÁ¬µ½¸ÃÍøÂç¡£
2. ʹÓÃÇŽÓģʽ£º
½«ÈÝÆ÷ÉèÖÃΪʹÓÃÇŽÓģʽ£¬ÕâÒâζ×ÅËüÃǽ«Ê¹ÓÃÓëÖ÷»úÏàͬµÄÍøÂç½Ó¿Ú£¬²¢»ñȡΨһµÄ IP µØµã¡£Í¨¹ýÉèÖà –network=bridge ²ÎÊýÀ´ÊµÏÖ¡£
3. ʹÓö˿ÚÓ³É䣺
½«ÈÝÆ÷¶Ë¿ÚÓ³Éäµ½Ö÷»ú¶Ë¿Ú£¬ÒÔ×èÖ¹ÈÝÆ÷Ö®¼ä¶Ë¿Ú³åÍ»¡£Ê¹Óà -p Ñ¡ÏÈÝÆ÷¶Ë¿ÚÖ¸¶¨Îª :¡£
4. ʹÓö˿ڹæÄ££º
Ϊ Docker ÈÝÆ÷ÉèÖö˿ڹæÄ££¬ÒÔ±ãÔÚÔËÐÐʱ×Ô¶¯·ÖÅɶ˿ڡ£Ê¹Óà –publish-range – Ñ¡ÏîÀ´ÊµÏÖ¡£
5. ʹÓÃ×ÓÍø£º
ÔÚ Docker ÍøÂçÖн¨Éè×ÓÍø£¬ÎªÈÝÆ÷Ìṩ¸ü´óµÄ IP µØµã¹æÄ£¡£Ê¹Óà docker network create –subnet ÏÂÁÉè×ÓÍø¡£
6. ʹÓÃÃû³ÆÆÊÎö£º
ʹÓÃÈÝÆ÷Ãû³ÆÆÊÎöÀ´È¡´ú IP µØµã£¬Ê¹ÈÝÆ÷Äܹ»Ê¹ÓÃÏ໥µÄÃû³ÆͨѶ¡£½«ÇéÐαäÁ¿ –dns ÉèÖÃΪ 127.0.0.11 »òÀàËƵصãÀ´ÊµÏÖ¡£
7. ʹÓà Docker Compose£º
ͨ¹ý Docker Compose ÖÎÀíÈÝÆ÷ʱ£¬Ê¹Óà network_mode: bridge Ñ¡ÏîÀ´±ÜÃâ³åÍ»¡£
8. ¼ì²é Docker Îĵµ£º
²Î¿¼¹Ù·½ Docker ÎĵµÒÔ»ñÈ¡¸üÏêϸµÄÖ¸µ¼ºÍʾÀý¡£
ÒÔÉϾÍÊÇdockerÍøÂç³åÍ»Ôõô°ìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡