×ðÁú¿­Ê±

dockerÈÝÆ÷idÔõô²é

docker ÈÝÆ÷ id ¿ÉÓÃÓÚ±êʶºÍÖÎÀíÈÝÆ÷¡£ÒÔÏÂÊDzéÕÒ id µÄËÄÖÖÒªÁ죺ÁгöÕýÔÚÔËÐеÄÈÝÆ÷£ºdocker psͨ¹ýÈÝÆ÷Ãû³Æ²éÕÒ id£ºdocker ps -a | grep “container name”ͨ¹ý¾µÏñÃû³Æ²éÕÒ id£ºdocker ps -a | grep “image name”ʹÓà docker api£ºcurl -x get http://localhost:2375/containers/json | jq -r ‘.[].id’

ÔõÑùÔÚ Docker ÖвéÕÒÈÝÆ÷ ID

Docker ÈÝÆ÷ ID ÊÇÒ»¸öΨһµÄ±êʶ·û£¬ÓÃÓÚʶ±ðºÍÖÎÀíÕýÔÚÔËÐлò×èÖ¹µÄÈÝÆ÷¡£ÒÔÏÂÊÇÔÚ Docker ÖвéÕÒÈÝÆ÷ ID µÄ°ì·¨£º

1. ÁгöÕýÔÚÔËÐеÄÈÝÆ÷

ʹÓà docker ps ÏÂÁî¿ÉÒÔÁгöÕýÔÚÔËÐеÄÈÝÆ÷£º

docker ps

µÇ¼ºó¸´ÖÆ

Êä³öÖн«ÏÔʾÒÔÏÂÁУº

CONTAINER ID

IMAGE

COMMAND

CREATED

STATUS

PORTS

NAMES

2. ͨ¹ýÈÝÆ÷Ãû³Æ²éÕÒÈÝÆ÷ ID

ÈôÊÇÖªµÀÈÝÆ÷Ãû³Æ£¬¿ÉÒÔʹÓà docker ps -a ÏÂÁî²éÕÒÈÝÆ÷ ID£¬ÆäÖÐ -a Ñ¡ÏîÁгöËùÓÐÈÝÆ÷£¬°üÀ¨ÒÑ×èÖ¹µÄÈÝÆ÷£º

docker ps -a | grep "CONTAINER NAME"

µÇ¼ºó¸´ÖÆ

3. ͨ¹ý¾µÏñÃû³Æ²éÕÒÈÝÆ÷ ID

ÈôÊÇÖªµÀ¾µÏñÃû³Æ£¬¿ÉÒÔʹÓà docker ps -a | grep “IMAGE NAME” ÏÂÁî²éÕÒÈÝÆ÷ ID£º

docker ps -a | grep "IMAGE NAME"

µÇ¼ºó¸´ÖÆ

4. ʹÓà Docker API ²éÕÒÈÝÆ÷ ID

Ò²¿ÉÒÔʹÓà Docker API ²éÕÒÈÝÆ÷ ID£º

curl -X GET http://localhost:2375/containers/json | jq -r '.[].Id'

µÇ¼ºó¸´ÖÆ

Êä³ö½«ÊÇËùÓÐÈÝÆ÷ ID µÄÁбí¡£

ÒÔÉϾÍÊÇdockerÈÝÆ÷idÔõô²éµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿