dockerÔõô²éÕÒÇéÐαäÁ¿
ÔÚ docker ÈÝÆ÷ÖвéÕÒÇéÐαäÁ¿µÄÒªÁ죺ֱ½Ó´òÓ¡±äÁ¿£ºÊ¹Óà echo $env_variable_name ÏÂÁîÖ±½ÓÊä³ö±äÁ¿¡£Ê¹Óà env ÏÂÁÊä³öÈÝÆ÷ÖÐËùÓÐÇéÐαäÁ¿ºÍÖµ¡£Ê¹Óà inspect ÏÂÁ»ñÈ¡ÈÝÆ÷ÉèÖã¬ÆäÖаüÀ¨ÇéÐαäÁ¿ÁÐ±í¡£
ÔõÑùÔÚ Docker ÖвéÕÒÇéÐαäÁ¿
Ö±½Ó´òÓ¡±äÁ¿
×î¼òÆÓµÄÒªÁìÊÇÖ±½ÓÔÚÈÝÆ÷ÖдòÓ¡ÇéÐαäÁ¿£º
echo $ENV_VARIABLE_NAME
µÇ¼ºó¸´ÖÆ
ÀýÈ磺
docker run --rm alpine echo $HOME
µÇ¼ºó¸´ÖÆ
ʹÓà env ÏÂÁî
env ÏÂÁîÁгöËùÓÐÇéÐαäÁ¿ºÍÖµ£º
docker run --rm alpine env
µÇ¼ºó¸´ÖÆ
Êä³ö£º
TERM=xterm-256color SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root
µÇ¼ºó¸´ÖÆ
ʹÓà inspect ÏÂÁî
docker inspect ÏÂÁî¿ÉÓÃÓÚ»ñÈ¡ÈÝÆ÷ÉèÖã¬ÆäÖаüÀ¨ÇéÐαäÁ¿ÁÐ±í£º
docker inspect --format '{{json .Config.Env}}' CONTAINER_ID
µÇ¼ºó¸´ÖÆ
Êä³ö£º
["HOME=/root", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM=xterm-256color"]
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇdockerÔõô²éÕÒÇéÐαäÁ¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£