ÔõÑùÔÚLinuxÉÏ×°ÖúÍÉèÖÃDocker
ÔõÑùÔÚlinuxÉÏ×°ÖúÍÉèÖÃdocker
¼ò½é£º
DockerÊÇÒ»¿î¿ªÔ´µÄÈÝÆ÷»¯Æ½Ì¨£¬Äܹ»ÇáËɵؽ«Ó¦ÓóÌÐò¼°ÆäÒÀÀµÏî´ò°ü³ÉÈÝÆ÷£¬Ê¹ÆäÔÚ²î±ðµÄ²Ù×÷ϵͳÉ϶¼Äܹ»ÎÞ·ìÔËÐС£Í¨¹ýʹÓÃDocker£¬ÎÒÃÇ¿ÉÒÔ¿ìËÙ¡¢ÇáÓ¯µØÖÎÀíºÍ°²ÅÅÓ¦ÓóÌÐò¡£±¾ÎĽ«ÏêϸÏÈÈÝÔõÑùÔÚlinuxÉÏ×°ÖúÍÉèÖÃdocker£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£
°ì·¨Ò»£º×°ÖÃDocker
¸üÐÂϵͳÈí¼þ°ü£º
sudo apt-get update
×°ÖÃÐëÒªµÄÈí¼þ°ü£¬ÓÃÓÚÔÊÐíaptͨ¹ýHTTPSʹÓþµÏñÔ´£º
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
Ìí¼ÓDocker¹Ù·½GPGÃÜÔ¿£º
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
ÉèÖÃDockerÎȹ̰æ¿ÍÕ»£º
echo “deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
¸üÐÂÈí¼þ°üË÷Òý£º
sudo apt-get update
×°ÖÃ×îа汾µÄDocker EngineºÍcontainerd£º
sudo apt-get install docker-ce docker-ce-cli containerd.io
ÑéÖ¤DockerÊÇ·ñÀÖ³É×°Öãº
docker –version
°ì·¨¶þ£ºÉèÖÃDocker
½¨ÉèDocker×飺
sudo groupadd docker
½«Ä¿½ñÓû§Ìí¼Óµ½docker×éÖУº
sudo usermod -aG docker $USER
Í˳öÄ¿½ñÖն˲¢ÖØеǼ£¬ÒÔ±ãʹ¸ü¸ÄÉúЧ¡£
°ì·¨Èý£ºÑéÖ¤Docker×°ÖúÍÉèÖÃ
ÔËÐÐhello-world¾µÏñ£º
docker run hello-world
ÈôÊÇÀÖ³ÉÔËÐУ¬½«ÏÔʾһÌõÐÂÎÅ£¬ËµÃ÷DockerÒÑ׼ȷװÖúÍÉèÖá£
°ì·¨ËÄ£º¼ÓËÙDocker¾µÏñÏÂÔØ£¨¿ÉÑ¡£©
ÈôÊÇÄã·¢Ã÷ÔÚÏÂÔØDocker¾µÏñʱËÙÂʽÏÂý£¬¿ÉÒÔͨ¹ýÉèÖú£ÄÚ¼ÓËÙÔ´À´¼ÓËÙÏÂÔØËÙÂÊ¡£ÒÔÏÂÊÇÒ»¸öʾÀý¡£
±à¼DockerÉèÖÃÎļþ£º
sudo nano /etc/docker/daemon.json
½«ÒÔÏÂÄÚÈÝÌí¼Óµ½ÎļþÖУº
{
"registry-mirrors": ["https://mykfwk8w.mirror.aliyuncs.com"]
µÇ¼ºó¸´ÖÆ
}
ÉúÑIJ¢¹Ø±ÕÎļþ¡£
ÖØÐÂÆô¶¯DockerЧÀÍ£º
sudo systemctl restart docker
×ܽ᣺
±¾ÎÄÏÈÈÝÁËÔÚLinuxÉÏ×°ÖúÍÉèÖÃDockerµÄÀú³Ì£¬²¢ÌṩÁËÏìÓ¦µÄ´úÂëʾÀý¡£Í¨¹ýƾ֤ÉÏÊö°ì·¨£¬Äã¿ÉÒÔÇáËɵØÔÚLinuxϵͳÉÏ×°ÖúÍÉèÖÃDocker£¬²¢×îÏÈʹÓÃÕâ¸öÇ¿Ê¢µÄÈÝÆ÷»¯Æ½Ì¨À´ÖÎÀíºÍ°²ÅÅÓ¦ÓóÌÐò¡£×£ÄãÓä¿ìµÄDockerÖ®Âã¡
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏ×°ÖúÍÉèÖÃDockerµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡