dockerÔõô²éÕÒÈÝÆ÷
Äú¿ÉÒÔʹÓà docker ÌṩµÄ¶àÖÖÒªÁì²éÕÒÈÝÆ÷£¬°üÀ¨£ºdocker cli£ºÊ¹ÓÃÏÂÁîÈç docker ps ÁгöÈÝÆ÷£¬²¢Ê¹ÓùýÂËÆ÷ËõСËÑË÷¹æÄ£¡£docker api£º·¢ËÍÇëÇóÒÔ¼ìË÷ÈÝÆ÷ÐÅÏ¢¡£docker compose£ºÊ¹ÓÃÏÂÁîÈç docker-compose ps ÁгöÈÝÆ÷¡£docker ¹¤¾ß£ºÊ¹Óà docker explorer »ò portainer µÈ¹¤¾ßÔÚͼÐνçÃæÖÐÖÎÀíÈÝÆ÷¡£ÈÝÆ÷ id£ºÊ¹ÓÃΨһ id Óë docker cli¡¢api »ò¹¤¾ßÒ»Æð²éÕÒÈÝÆ÷¡£
ÔõÑù²éÕÒ Docker ÈÝÆ÷
Docker ÌṩÁ˶àÖÖÒªÁìÀ´²éÕÒºÍɸѡÈÝÆ÷¡£ÒÔÏÂÊǼ¸ÖÖ³£ÓõÄÒªÁ죺
1. ʹÓà Docker CLI ²éÕÒÈÝÆ÷
# ÁгöËùÓÐÈÝÆ÷ docker ps # ¹ýÂËÈÝÆ÷Áбí docker ps -a # ÁгöËùÓÐÈÝÆ÷£¬°üÀ¨ÒÑ×èÖ¹µÄÈÝÆ÷ docker ps --filter "name=my-container" # ¹ýÂËÃû³ÆΪ "my-container" µÄÈÝÆ÷
µÇ¼ºó¸´ÖÆ
2. ʹÓà Docker API ²éÕÒÈÝÆ÷
# ʹÓà curl ·¢ËÍÇëÇó curl -X GET -H "Content-Type: application/json" http://localhost:2375/containers/json
µÇ¼ºó¸´ÖÆ
3. ʹÓà Docker Compose ²éÕÒÈÝÆ÷
# ÁгöËùÓÐÈÝÆ÷ docker-compose ps # ¹ýÂËÈÝÆ÷Áбí docker-compose ps --filter "name=my-container" # ¹ýÂËÃû³ÆΪ "my-container" µÄÈÝÆ÷
µÇ¼ºó¸´ÖÆ
4. ʹÓà Docker ¹¤¾ß²éÕÒÈÝÆ÷
Docker Explorer£ºÒ»¸öͼÐνçÃ棬ÔÊÐíÄúä¯ÀÀºÍÖÎÀí Docker ÈÝÆ÷¡£
Portainer£ºÒ»¸ö¿ªÔ´ÈÝÆ÷ÖÎÀíƽ̨£¬Ìṩһ¸öͼÐνçÃæÀ´ÖÎÀíÈÝÆ÷¡£
5. ʹÓà Docker ÈÝÆ÷ ID ²éÕÒÈÝÆ÷
ÿ¸öÈÝÆ÷¶¼·ÖÅÉÁËÒ»¸öΨһµÄ ID¡£Äú¿ÉÒÔʹÓÃ´Ë ID Óë Docker CLI¡¢API »ò¹¤¾ßÒ»Æð²éÕÒÈÝÆ÷¡£
# ʹÓà Docker CLI docker inspect <container-id></container-id>
µÇ¼ºó¸´ÖÆ
ÌáÐÑ£º
ʹÓà -f »ò –filter Ñ¡Ïî¹ýÂËÈÝÆ÷ÁÐ±í£¬ÒÔËõСËÑË÷¹æÄ£¡£
Äú»¹¿ÉÒÔʹÓà docker inspect ÏÂÁîÀ´Éó²éÓйØÌض¨ÈÝÆ÷µÄÏêϸÐÅÏ¢£¬°üÀ¨Æä ID¡¢Ãû³Æ¡¢Í¼ÏñºÍÆäËûÔªÊý¾Ý¡£
ÒÔÉϾÍÊÇdockerÔõô²éÕÒÈÝÆ÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡