docker°²ÅÅÍêÔõôʹÓÃ
docker °²ÅźóʹÓÃÁù¸ö°ì·¨£ºÅþÁ¬µ½ÈÝÆ÷¡¢Æô¶¯Ó¦ÓóÌÐò¡¢»á¼ûÓ¦ÓóÌÐò¡¢×°ÖÃÈí¼þ¡¢ÐÞ¸ÄÎļþ¡¢Ò»Á¬¼¯³ÉºÍ°²ÅÅ¡£
Docker °²ÅźóÔõÑùʹÓÃ
µÚÒ»²½£ºÅþÁ¬µ½ Docker ÈÝÆ÷
²éÕÒ Docker ÈÝÆ÷µÄÈÝÆ÷ ID£ºdocker ps
ʹÓÃÏÂÁîÅþÁ¬µ½ÈÝÆ÷£ºdocker exec -it CONTAINER_ID bash£¬ÆäÖÐ CONTAINER_ID ÊÇÈÝÆ÷µÄ ID¡£
µÚ¶þ²½£ºÆô¶¯Ó¦ÓóÌÐò
´ó´ó¶¼ Docker ¾µÏñ¶¼°üÀ¨Ò»¸öÆô¶¯¾ç±¾»òÏÂÁî¡£
ÔËÐÐÆô¶¯¾ç±¾»òÏÂÁÀýÈ磬python manage.py runserver¡£
µÚÈý²½£º»á¼ûÓ¦ÓóÌÐò
ÕÒµ½ÈÝÆ÷µÄ¶Ë¿ÚÓ³É䣺docker inspect CONTAINER_ID
ʹÓÃÈÝÆ÷µÄ¹ûÕæ¶Ë¿Ú´ÓËÞÖ÷»úе»á¼ûÓ¦ÓóÌÐò¡£ÀýÈ磬ÈôÊǶ˿ÚÓ³ÉäΪ 8000£¬Çë»á¼û http://localhost:8000¡£
µÚËIJ½£ºÔÚÈÝÆ÷ÖÐ×°ÖÃÆäËûÈí¼þ
ÔËÐÐ apt-get update ºÍ apt-get install ÏÂÁîÀ´×°ÖÃÈí¼þ¡£
ÀýÈ磬ҪװÖà Nginx£¬ÇëÔËÐУºapt-get update && apt-get install nginx¡£
µÚÎå²½£ºÐÞ¸ÄÈÝÆ÷ÖеÄÎļþ
ʹÓà docker cp ÏÂÁîÔÚËÞÖ÷»úеºÍÈÝÆ÷Ö®¼ä¸´ÖÆÎļþ¡£
ÀýÈ磬Ҫ¸´ÖÆÎļþµ½ÈÝÆ÷ÖУ¬ÇëÔËÐУºdocker cp /path/to/local/file CONTAINER_ID:/path/to/container/file¡£
µÚÁù²½£ºÒ»Á¬¼¯³ÉºÍ°²ÅÅ
ʹÓà Docker Compose »ò Kubernetes µÈ¹¤¾ß×Ô¶¯»¯°²ÅÅÀú³Ì¡£
ÕâЩ¹¤¾ßÔÊÐíÄú½ç˵ÈÝÆ÷¼°ÆäÒÀÀµÏîµÄÉèÖÃÎļþ£¬²¢×Ô¶¯»¯ÈÝÆ÷µÄ½¨Éè¡¢Æô¶¯ºÍ¸üС£
ÆäËûÌáÐÑ£º
ʹÓà docker logs ÏÂÁîÉó²éÈÝÆ÷ÈÕÖ¾¡£
ʹÓà docker stop ºÍ docker start ÏÂÁîÆô¶¯ºÍ×èÖ¹ÈÝÆ÷¡£
ʹÓà docker restart ÏÂÁîÖØÐÂÆô¶¯ÈÝÆ÷¡£
ÒÔÉϾÍÊÇdocker°²ÅÅÍêÔõôʹÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡