dockerÔõô²éÇéÐαäÁ¿
ÔõÑùÉó²é docker ÈÝÆ÷ÖеÄÇéÐαäÁ¿
Docker ÈÝÆ÷ÊÇÒ»ÖÖÇáÁ¿¼¶µÄÐéÄâÇéÐΣ¬ÓÃÓÚ¸ôÀëºÍ´ò°üÓ¦ÓóÌÐò¼°ÒÀÀµÏî¡£ËüÌṩÁËһϵÁÐÇéÐαäÁ¿£¬ÓÃÓÚÉèÖúͿØÖÆÈÝÆ÷µÄÔËÐÐʱÐÐΪ¡£
ÒªÉó²é Docker ÈÝÆ÷ÖеÄÇéÐαäÁ¿£¬¿ÉÒÔʹÓÃÒÔÏ°취£º
1. »ñÈ¡ÈÝÆ÷ ID
docker ps -a
µÇ¼ºó¸´ÖÆ
´ËÏÂÁÁгöËùÓÐÕýÔÚÔËÐкÍÒÑ×èÖ¹µÄÈÝÆ÷¡£ÕÒµ½Òª¼ì²éµÄÇéÐαäÁ¿µÄÈÝÆ÷ ID¡£
2. Éó²éÇéÐαäÁ¿
¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÉó²éÈÝÆ÷µÄÇéÐαäÁ¿£º
docker inspect -f '{{json .Config.Env}}' <container-id></container-id>
µÇ¼ºó¸´ÖÆ
ÆäÖÐ ÊÇ°ì·¨ 1 ÖлñµÃµÄÈÝÆ÷ ID¡£
´ËÏÂÁÊä³öÒ»¸ö JSON ¹¤¾ß£¬ÆäÖаüÀ¨ÈÝÆ÷µÄÇéÐαäÁ¿ÁÐ±í¡£JSON ¹¤¾ßµÄÃûÌÃÈçÏ£º
[ "KEY1=VALUE1", "KEY2=VALUE2", ... ]
µÇ¼ºó¸´ÖÆ
ÆäÖÐ KEY ÊÇÇéÐαäÁ¿µÄÃû³Æ£¬VALUE ÊÇÆäÖµ¡£
ʾÀý
ÀýÈ磬ҪÉó²éÃûΪ “my-container” µÄÈÝÆ÷ÖеÄÇéÐαäÁ¿£¬¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁ
docker inspect -f '{{json .Config.Env}}' my-container
µÇ¼ºó¸´ÖÆ
Õ⽫Êä³öÒ»¸öÀàËÆÓÚÒÔÏÂÄÚÈÝµÄ JSON ¹¤¾ß£º
[ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "USER=my-user", ... ]
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇdockerÔõô²éÇéÐαäÁ¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡