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

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Ôõô²éÕÒÇéÐαäÁ¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ