dockerÔõôÆô¶¯ÈÝÆ÷
docker ÈÝÆ÷Æô¶¯°ì·¨£ºÀÈ¡ÈÝÆ÷¾µÏñ£ºÔËÐÐ “docker pull [¾µÏñÃû³Æ]”¡£½¨ÉèÈÝÆ÷£ºÊ¹Óà “docker create [Ñ¡Ïî] [¾µÏñÃû³Æ] [ÏÂÁîºÍ²ÎÊý]”¡£Æô¶¯ÈÝÆ÷£ºÖ´ÐÐ “docker start [ÈÝÆ÷Ãû³Æ»ò id]”¡£¼ì²éÈÝÆ÷״̬£ºÍ¨¹ý “docker ps” ÑéÖ¤ÈÝÆ÷ÊÇ·ñÕýÔÚÔËÐС£
ÔõÑùÆô¶¯ Docker ÈÝÆ÷
Æô¶¯ Docker ÈÝÆ÷µÄÀú³ÌºÜÊǼòÆÓ£¬ÒÔÏ°취½«Ö¸µ¼ÄãÍê³É²Ù×÷£º
°ì·¨ 1£ºÀÈ¡ÈÝÆ÷¾µÏñ
Ê×ÏÈ£¬ÄãÐèÒª»ñÈ¡ËùÐèµÄÈÝÆ÷¾µÏñ¡£Äã¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
docker pull [¾µÏñÃû³Æ]
µÇ¼ºó¸´ÖÆ
ÀýÈ磬ҪÀÈ¡ Nginx ¾µÏñ£¬ÇëÔËÐУº
docker pull nginx
µÇ¼ºó¸´ÖÆ
°ì·¨ 2£º½¨ÉèÈÝÆ÷
ÀÈ¡¾µÏñºó£¬Äã¿ÉÒÔʹÓà docker create ÏÂÁÉèÈÝÆ÷¡£¸ÃÏÂÁîÔÊÐíÄãÉèÖÃÈÝÆ÷ÉèÖã¬ÀýÈç¶Ë¿ÚÓ³Éä¡¢ÇéÐαäÁ¿µÈ¡£
docker create [Ñ¡Ïî] [¾µÏñÃû³Æ] [ÏÂÁîºÍ²ÎÊý]
µÇ¼ºó¸´ÖÆ
ÀýÈ磬ÒÔÏÂÏÂÁ½¨ÉèÒ»¸öÃûΪ my-nginx µÄ Nginx ÈÝÆ÷£¬¸ÃÈÝÆ÷¹ûÕæ 80 ¶Ë¿Ú£º
docker create --name my-nginx -p 80:80 nginx
µÇ¼ºó¸´ÖÆ
°ì·¨ 3£ºÆô¶¯ÈÝÆ÷
½¨ÉèÈÝÆ÷ºó£¬Äã¿ÉÒÔʹÓà docker start ÏÂÁîÆô¶¯Ëü¡£
docker start [ÈÝÆ÷Ãû³Æ»ò ID]
µÇ¼ºó¸´ÖÆ
ÀýÈ磬ҪÆô¶¯ my-nginx ÈÝÆ÷£¬ÇëÔËÐУº
docker start my-nginx
µÇ¼ºó¸´ÖÆ
°ì·¨ 4£º¼ì²éÈÝÆ÷״̬
ÒªÑéÖ¤ÈÝÆ÷ÊÇ·ñÒÑÆô¶¯²¢ÕýÔÚÔËÐУ¬ÇëʹÓà docker ps ÏÂÁî¡£
docker ps
µÇ¼ºó¸´ÖÆ
Äã»á¿´µ½Ò»¸öÊä³öÁÐ±í£¬ÏÔʾÕýÔÚÔËÐеÄÈÝÆ÷¡£ÈôÊÇ¿´µ½ my-nginx ÈÝÆ÷ÕýÔÚÔËÐУ¬Ôò˵Ã÷Æô¶¯Àֳɡ£
ÒÔÉϾÍÊÇdockerÔõôÆô¶¯ÈÝÆ÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡