×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùʹÓÃDocker¾ÙÐÐÍøÂçÉèÖúÍÇå¾²ÖÎÀí

ÔõÑùʹÓÃDocker¾ÙÐÐÍøÂçÉèÖúÍÇå¾²ÖÎÀí

Ëæ×ÅÔÆÅÌËãºÍÈÝÆ÷»¯ÊÖÒÕµÄÉú³¤ £¬DockerÒѳÉΪÁËÒ»ÖÖÆÕ±éʹÓõÄÈÝÆ÷»¯Æ½Ì¨¡£Í¨¹ýʹÓÃDocker £¬ÎÒÃÇ¿ÉÒÔÀû±ãµØ½¨Éè¡¢°²ÅźÍÖÎÀíÖÖÖÖÓ¦Óá£È»¶ø £¬ÍøÂçÉèÖúÍÇå¾²ÖÎÀíÒ²ÊÇʹÓÃDockerµÄÒªº¦·½Ãæ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃDocker¾ÙÐÐÍøÂçÉèÖúÍÇå¾²ÖÎÀí £¬²¢ÌṩһЩÏêϸµÄ´úÂëʾÀý¡£

Ò»¡¢ÍøÂçÉèÖÃ

½¨ÉèÍøÂç

ÔÚDockerÖÐ £¬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁÉèÒ»¸ö×Ô½ç˵µÄÍøÂ磺

docker network create mynetwork

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁ½¨ÉèÒ»¸öÃûΪmynetworkµÄÐÂÍøÂç¡£

ÅþÁ¬ÈÝÆ÷µ½ÍøÂç

Òª½«ÈÝÆ÷ÅþÁ¬µ½Ìض¨ÍøÂç £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

docker network connect mynetwork container_name

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁÈÝÆ÷ÅþÁ¬µ½ÃûΪmynetworkµÄÍøÂç¡£

¼ì²éÍøÂçÅþÁ¬

Òª¼ì²éÈÝÆ÷ÊÇ·ñÅþÁ¬µ½Ìض¨ÍøÂç £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ

docker network inspect mynetwork

µÇ¼ºó¸´ÖÆ

Õâ¸öÏÂÁÏÔʾÓëÍøÂçÏà¹ØµÄÏêϸÐÅÏ¢ £¬°üÀ¨ÅþÁ¬µ½¸ÃÍøÂçµÄÈÝÆ÷ÁÐ±í¡£

¶þ¡¢Çå¾²ÖÎÀí

ʹÓûá¼û¿ØÖÆÁÐ±í£¨ACL£©

DockerÔÊÐíÎÒÃÇʹÓÃACLÀ´¿ØÖÆÈÝÆ÷µÄ»á¼ûȨÏÞ¡£ÎÒÃÇ¿ÉÒÔͨ¹ý±à¼­DockerµÄÉèÖÃÎļþ£¨Í¨³£ÊÇ/etc/docker/daemon.json£©À´ÆôÓÃACL £¬²¢½ç˵»á¼û¹æÔò¡£ÒÔÏÂÊÇÒ»¸öʾÀýÉèÖãº

{
  "authorization-plugins": ["acl"],
  "acl": [
 {
   "name": "allow_admin",
   "source": {"type": "user", "name": "admin"},
   "target": {"type": "container"}
 },
 {
   "name": "deny_guest",
   "source": {"type": "user", "name": "guest"},
   "target": {"type": "container"}
 }
  ]
}

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÉèÖÃÖÐ £¬ÎÒÃǽç˵ÁËÁ½¸öACL¹æÔò¡£µÚÒ»¸ö¹æÔòÔÊÐíÃûΪadminµÄÓû§»á¼ûËùÓÐÈÝÆ÷ £¬¶øµÚ¶þ¸ö¹æÔòեȡÃûΪguestµÄÓû§»á¼ûÈÝÆ÷¡£ÕâÑù £¬ÎÒÃÇ¿ÉÒÔͨ¹ýACLÀ´ÏÞÖÆË­¿ÉÒÔ»á¼ûÈÝÆ÷¡£

ʹÓÃÇå¾²¾µÏñ

Docker¾µÏñÊÇÈÝÆ÷µÄ»ù´¡ £¬Òò´ËÇå¾²¾µÏñÊÇʵÏÖÈÝÆ÷Çå¾²µÄÖ÷Òª×é³É²¿·Ö¡£ÎÒÃÇ¿ÉÒÔÑ¡ÔñʹÓÃÇå¾²µÄ»ù´¡¾µÏñ £¬»òÕßͨ¹ýÔÚ¹¹½¨¾µÏñʱ¸üкÍÐÞ¸´Îó²îÀ´È·±£¾µÏñµÄÇå¾²ÐÔ¡£ÒÔÏÂÊÇһЩÏêϸµÄʾÀý´úÂ룺

ʹÓÃÇå¾²µÄ»ù´¡¾µÏñ£º

FROM ubuntu:20.04

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖÐ £¬ÎÒÃÇÑ¡ÔñÁËÒ»¸ö¹Ù·½µÄUbuntu 20.04¾µÏñ×÷Ϊ»ù´¡¾µÏñ¡£Õâ¸ö¾µÏñÒѾ­Óɹٷ½ÑéÖ¤²¢°´ÆÚ¸üР£¬Òò´Ë¾ßÓнϸߵÄÇå¾²ÐÔ¡£

¸üкÍÐÞ¸´Îó²î£º

FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade -y

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖÐ £¬ÎÒÃÇÔÚ¹¹½¨¾µÏñʱʹÓÃapt-getÏÂÁî¸üкÍÉý¼¶²Ù×÷ϵͳÖеÄÈí¼þ°ü £¬ÒÔÐÞ¸´ÒÑÖªµÄÎó²î¡£

ͨ¹ýÑ¡ÔñÇå¾²µÄ»ù´¡¾µÏñºÍʵʱ¸üкÍÐÞ¸´¾µÏñÖеÄÎó²î £¬ÎÒÃÇ¿ÉÒÔÌá¸ßÈÝÆ÷µÄÇå¾²ÐÔ¡£

Èý¡¢×ܽá

ʹÓÃDocker¾ÙÐÐÍøÂçÉèÖúÍÇå¾²ÖÎÀíÊÇÈÝÆ÷»¯Ó¦Óð²ÅŵÄÖ÷Òª·½Ãæ¡£ÎÒÃÇ¿ÉÒÔͨ¹ý½¨ÉèÍøÂç¡¢ÅþÁ¬ÈÝÆ÷µ½Ìض¨ÍøÂçºÍ¼ì²éÍøÂçÅþÁ¬À´¾ÙÐÐÍøÂçÉèÖ᣶øͨ¹ýʹÓÃACLºÍÇå¾²¾µÏñ £¬ÎÒÃÇ¿ÉÒÔʵÑé»á¼û¿ØÖƺÍÌá¸ßÈÝÆ÷µÄÇå¾²ÐÔ¡£

ͨ¹ýÉÏÊöÏÈÈݵÄÒªÁìºÍʾÀý´úÂë £¬Ï£ÍûÄܹ»×ÊÖú¶ÁÕ߸üºÃµØʹÓÃDocker¾ÙÐÐÍøÂçÉèÖúÍÇå¾²ÖÎÀí¡£Ê¹ÓÃÕâЩҪÁì £¬ÎÒÃÇ¿ÉÒÔ¸üºÃµØÖÎÀíºÍ± £»¤ÈÝÆ÷»¯Ó¦Óà £¬Ìá¸ßϵͳµÄ¿ÉÓÃÐÔºÍÇå¾²ÐÔ¡£

ÒÔÉϾÍÊÇÔõÑùʹÓÃDocker¾ÙÐÐÍøÂçÉèÖúÍÇå¾²ÖÎÀíµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ