dockerÔõôÊäÈëÏÂÁî
docker ÏÂÁîÊäÈëµÄÒªÁìÓУºÖ±½ÓÔÚ docker Ö÷»úµÄÖÕ¶ËÖÐÊäÈë docker ÏÂÁîʹÓà docker compose ÎļþÖÎÀí¶à¸öÈÝÆ÷ͨ¹ý docker cli ÔËÐÐÏÂÁîʹÓà docker api Ö±½ÓÓë docker ÊØ»¤Àú³Ì½»»¥Ö´Ðн»»¥Ê½ÏÂÁîÔÚÈÝÆ÷ÖÐÖ´ÐÐÏÂÁîʹÓõÚÈý·½¹¤¾ßÖÎÀí docker ºÍÊäÈëÏÂÁÈç kubernetes¡¢portainer »ò rancher
Docker ÏÂÁîÊäÈëÒªÁì
Ö±½ÓÊäÈë
ÔÚ Docker Ö÷»úµÄÖÕ¶ËÖУ¬Ö±½ÓÊäÈë Docker ÏÂÁÀýÈ磺
docker ps # Éó²éÕýÔÚÔËÐеÄÈÝÆ÷
µÇ¼ºó¸´ÖÆ
Docker Compose
ʹÓà Docker Compose ÎļþÖÎÀí¶à¸öÈÝÆ÷¡£ÔÚ Docker Compose ÎļþËùÔÚĿ¼ÏÂÖ´ÐУº
docker-compose up # Æô¶¯ËùÓнç˵µÄÈÝÆ÷
µÇ¼ºó¸´ÖÆ
ʹÓà Docker CLI
ͨ¹ý Docker CLI ÔËÐÐÏÂÁʹÓà docker ǰ׺£¬ÀýÈ磺
docker run --name my-container ubuntu:22.04
µÇ¼ºó¸´ÖÆ
ʹÓà Docker API
ʹÓà Docker API Ö±½ÓÓë Docker ÊØ»¤Àú³Ì½»»¥¡£Ê¹Óà HTTP ÇëÇó·¢ËÍÏÂÁÀýÈ磺
curl -X POST http://localhost:2375/containers/create -d '{"Image": "ubuntu:22.04"}'
µÇ¼ºó¸´ÖÆ
½»»¥Ê½ÏÂÁî
ÔÚÈÝÆ÷ÖÐÖ´Ðн»»¥Ê½ÏÂÁʹÓà docker exec -it ÏÂÁÀýÈ磺
docker exec -it my-container bash
µÇ¼ºó¸´ÖÆ
ÆäËûÒªÁì
Docker Desktop£ºÊ¹Óà Docker Desktop ÌṩµÄͼÐνçÃæÊäÈëÏÂÁî¡£
Kubernetes£ºÔÚ Kubernetes ¼¯ÈºÖÐͨ¹ý kubectl ÏÂÁîÊäÈë Docker ÏÂÁî¡£
µÚÈý·½¹¤¾ß£ºÊ¹Óà Portainer »ò Rancher Æ·¼¶Èý·½¹¤¾ßÖÎÀí Docker ºÍÊäÈëÏÂÁî¡£
ÒÔÉϾÍÊÇdockerÔõôÊäÈëÏÂÁîµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡