Ó¢»ª£¡Docker ³£ÓÃÏÂÁî´óÈ«
±¾ÎÄ°üÀ¨ÈÝÆ÷ÉúÃüÖÜÆÚÖÎÀíÏÂÁî¡¢ÈÝÆ÷²Ù×÷ÏÂÁî¡¢ÈÝÆ÷rootfsÏÂÁî¡¢¾µÏñ¿ÍÕ»ÏÂÁî¡¢ÍâµØ¾µÏñÖÎÀíÏÂÁîºÍ»ù´¡°æ±¾ÐÅÏ¢ÏÂÁî¡£
ÈÝÆ÷ÉúÃüÖÜÆÚÖÎÀíÏÂÁî
run
½¨ÉèÒ»¸öеÄÈÝÆ÷¡£
# ʹÓÃdocker¾µÏñnginx:latestÒÔºǫ́ģʽÆô¶¯Ò»¸öÈÝÆ÷,# ²¢½«ÈÝÆ÷ÃüÃûΪmynginx¡£ docker run --name mynginx -d nginx:latest # ʹÓþµÏñ nginx:latest£¬ÒÔºǫ́ģʽÆô¶¯Ò»¸öÈÝÆ÷,# ½«ÈÝÆ÷µÄ 80 ¶Ë¿ÚÓ³Éäµ½Ö÷»úµÄ 80 ¶Ë¿Ú,# Ö÷»úµÄĿ¼ /data Ó³Éäµ½ÈÝÆ÷µÄ /data¡£ docker run -p 80:80 -v /data:/data -d nginx:latest # ʹÓþµÏñnginx:latestÒÔ½»»¥Ä£Ê½Æô¶¯Ò»¸öÈÝÆ÷,# ÔÚÈÝÆ÷ÄÚÖ´ÐÐ/bin/bashÏÂÁî¡£ docker run -it nginx:latest /bin/bash
µÇ¼ºó¸´ÖÆ
start/stop/restart
docker start : Æô¶¯Ò»¸ö»ò¶à¸öÒѾ±»×èÖ¹µÄÈÝÆ÷¡£
docker stop : ×èÖ¹Ò»¸öÔËÐÐÖеÄÈÝÆ÷¡£
docker restart : ÖØÆôÈÝÆ÷¡£
# Æô¶¯Òѱ»×èÖ¹µÄÈÝÆ÷mynginx docker start mynginx # ×èÖ¹ÔËÐÐÖеÄÈÝÆ÷mynginx docker stop mynginx # ÖØÆôÈÝÆ÷mynginx docker restart mynginx
µÇ¼ºó¸´ÖÆ
kill
ɱµôÒ»¸öÔËÐÐÖеÄÈÝÆ÷¡£¿ÉÑ¡²ÎÊý£º
-s : ·¢ËÍʲôÐźŵ½ÈÝÆ÷£¬Ä¬ÈÏ KILL
# ƾ֤ÈÝÆ÷Ãû×ÖɱµôÈÝÆ÷ docker kill tomcat7 # ƾ֤ÈÝÆ÷IDɱµôÈÝÆ÷ docker kill 65d4a94f7a39
µÇ¼ºó¸´ÖÆ
rm
ɾ³ýÒ»¸ö»ò¶à¸öÈÝÆ÷¡£
# Ç¿ÖÆɾ³ýÈÝÆ÷ db01¡¢db02£º docker rm -f db01 db02 # ɾ³ýÈÝÆ÷ nginx01, ²¢É¾³ýÈÝÆ÷¹ÒÔصÄÊý¾Ý¾í£º docker rm -v nginx01 # ɾ³ýËùÓÐÒѾ×èÖ¹µÄÈÝÆ÷£º docker rm $(docker ps -a -q)
µÇ¼ºó¸´ÖÆ
create
½¨ÉèÒ»¸öеÄÈÝÆ÷µ«²»Æô¶¯Ëü¡£
# ʹÓÃdocker¾µÏñnginx:latest½¨ÉèÒ»¸öÈÝÆ÷,²¢½«ÈÝÆ÷ÃüÃûΪmynginx docker create --name mynginx nginx:latest
µÇ¼ºó¸´ÖÆ
exec
ÔÚÔËÐеÄÈÝÆ÷ÖÐÖ´ÐÐÏÂÁî¡£¿ÉÑ¡²ÎÊý£º
-d : Êèɢģʽ: ÔÚºǫ́ÔËÐÐ
-i : ×ÝȻûÓи½¼ÓÒ²¼á³ÖSTDIN ·¿ª
-t : ·ÖÅÉÒ»¸öαÖÕ¶Ë
# ÔÚÈÝÆ÷ mynginx ÖÐÒÔ½»»¥Ä£Ê½Ö´ÐÐÈÝÆ÷ÄÚ /root/nginx.sh ¾ç±¾ docker exec -it mynginx /bin/sh /root/nginx.sh # ÔÚÈÝÆ÷ mynginx ÖпªÆôÒ»¸ö½»»¥Ä£Ê½µÄÖÕ¶Ë docker exec -i -t mynginx /bin/bash # Ò²¿ÉÒÔͨ¹ý docker ps -a ÏÂÁîÉó²éÒѾÔÚÔËÐеÄÈÝÆ÷£¬È»ºóʹÓÃÈÝÆ÷ ID ½øÈëÈÝÆ÷¡£ docker ps -a docker exec -it 9df70f9a0714 /bin/bash
µÇ¼ºó¸´ÖÆ
pause/unpause
docker pause :ÔÝÍ£ÈÝÆ÷ÖÐËùÓеÄÀú³Ì¡£
docker unpause :»Ö¸´ÈÝÆ÷ÖÐËùÓеÄÀú³Ì¡£
# ÔÝÍ£Êý¾Ý¿âÈÝÆ÷db01ÌṩЧÀÍ¡£ docker pause db01 # »Ö¸´Êý¾Ý¿âÈÝÆ÷ db01 ÌṩЧÀÍ docker unpause db0
µÇ¼ºó¸´ÖÆ
ÈÝÆ÷²Ù×÷ÏÂÁî
ps
ÁгöÈÝÆ÷¡£¿ÉÑ¡²ÎÊý£º
-a : ÏÔʾËùÓеÄÈÝÆ÷£¬°üÀ¨Î´ÔËÐеġ£
-f : ƾ֤Ìõ¼þ¹ýÂËÏÔʾµÄÄÚÈÝ¡£
¨Cformat : Ö¸¶¨·µ»ØÖµµÄÄ£°åÎļþ¡£
-l : ÏÔʾ×î½ü½¨ÉèµÄÈÝÆ÷¡£
-n : Áгö×î½ü½¨ÉèµÄn¸öÈÝÆ÷¡£
¨Cno-trunc : ²»½Ø¶ÏÊä³ö¡£
-q : ¾²Ä¬Ä£Ê½£¬Ö»ÏÔʾÈÝÆ÷±àºÅ¡£
-s : ÏÔʾ×ܵÄÎļþ¾Þϸ¡£
# ÁгöËùÓÐÔÚÔËÐеÄÈÝÆ÷ÐÅÏ¢¡£ docker ps # Áгö×î½ü½¨ÉèµÄ5¸öÈÝÆ÷ÐÅÏ¢¡£ docker ps -n 5 # ÁгöËùÓн¨ÉèµÄÈÝÆ÷ID¡£ docker ps -a -q
µÇ¼ºó¸´ÖÆ
Ôö²¹ËµÃ÷£º
ÈÝÆ÷µÄ7ÖÖ״̬£ºcreated£¨Òѽ¨É裩¡¢restarting£¨ÖØÆôÖУ©¡¢running£¨ÔËÐÐÖУ©¡¢removing£¨Ç¨áãÖУ©¡¢paused£¨ÔÝÍ££©¡¢exited£¨×èÖ¹£©¡¢dead£¨éæÃü£©¡£
inspect
»ñÈ¡ÈÝÆ÷/¾µÏñµÄÔªÊý¾Ý¡£¿ÉÑ¡²ÎÊý£º
-f : Ö¸¶¨·µ»ØÖµµÄÄ£°åÎļþ¡£
-s : ÏÔʾ×ܵÄÎļþ¾Þϸ¡£
¨Ctype : Ϊָ¶¨ÀàÐÍ·µ»ØJSON¡£
# »ñÈ¡¾µÏñmysql:5.7µÄÔªÐÅÏ¢¡£ docker inspect mysql:5.7 # »ñÈ¡ÕýÔÚÔËÐеÄÈÝÆ÷mymysqlµÄ IP¡£ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mymysql
µÇ¼ºó¸´ÖÆ
top
Éó²éÈÝÆ÷ÖÐÔËÐеÄÀú³ÌÐÅÏ¢£¬Ö§³Ö ps ÏÂÁî²ÎÊý¡£
# Éó²éÈÝÆ÷mymysqlµÄÀú³ÌÐÅÏ¢¡£ docker top mymysql # Éó²éËùÓÐÔËÐÐÈÝÆ÷µÄÀú³ÌÐÅÏ¢¡£ for i in `docker ps |grep Up|awk '{print $1}'`;do echo \ &&docker top $i; done
µÇ¼ºó¸´ÖÆ
events
»ñȡʵʱÊƼþ¡£²ÎÊý˵Ã÷£º
-f £º ƾ֤Ìõ¼þ¹ýÂËÊÂÎñ£»
¨Csince £º ´ÓÖ¸¶¨µÄʱ¼ä´ÁºóÏÔʾËùÓÐÊÂÎñ£»
¨Cuntil £º Á÷ˮʱ¼äÏÔʾµ½Ö¸¶¨µÄʱ¼äΪֹ£»
# ÏÔʾdocker 2016Äê7ÔÂ1ÈÕºóµÄËùÓÐÊÂÎñ¡£ docker events --since="1467302400" # ÏÔʾdocker ¾µÏñΪmysql:5.6 2016Äê7ÔÂ1ÈÕºóµÄÏà¹ØÊÂÎñ¡£ docker events -f "image"="mysql:5.6" --since="1467302400"
µÇ¼ºó¸´ÖÆ
˵Ã÷£ºÈôÊÇÖ¸¶¨µÄʱ¼äÊǵ½Ã뼶µÄ£¬ÐèÒª½«Ê±¼äת³Éʱ¼ä´Á¡£ÈôÊÇʱ¼äΪÈÕÆڵĻ°£¬¿ÉÒÔÖ±½ÓʹÓã¬Èç¨Csince=¡°2016-07-01¡±¡£
logs
»ñÈ¡ÈÝÆ÷µÄÈÕÖ¾¡£²ÎÊý˵Ã÷£º
-f : ¸ú×ÙÈÕÖ¾Êä³ö
¨Csince : ÏÔʾij¸ö×îÏÈʱ¼äµÄËùÓÐÈÕÖ¾
-t : ÏÔʾʱ¼ä´Á
¨Ctail : ½öÁгö×îÐÂNÌõÈÝÆ÷ÈÕÖ¾
# ¸ú×ÙÉó²éÈÝÆ÷mynginxµÄÈÕÖ¾Êä³ö¡£ docker logs -f mynginx # Éó²éÈÝÆ÷mynginx´Ó2016Äê7ÔÂ1ÈÕºóµÄ×îÐÂ10ÌõÈÕÖ¾¡£ docker logs --since="2016-07-01" --tail=10 mynginx
µÇ¼ºó¸´ÖÆ
export
½«Îļþϵͳ×÷Ϊһ¸ötar¹éµµÎļþµ¼³öµ½STDOUT¡£²ÎÊý˵Ã÷£º
Å£±Æ°¡£¡½Ó˽»î±Ø±¸µÄ N ¸ö¿ªÔ´ÏîÄ¿£¡¸ÏæÕä²Ø
µÇ¼ºó¸´ÖÆ
-o : ½«ÊäÈëÄÚÈÝдµ½Îļþ¡£
# ½«idΪa404c6c174a2µÄÈÝÆ÷°´ÈÕÆÚÉúÑÄΪtarÎļþ¡£ docker export -o mysql-`date +%Y%m%d`.tar a404c6c174a2 ls mysql-`date +%Y%m%d`.tar
µÇ¼ºó¸´ÖÆ
port
ÁгöÖ¸¶¨µÄÈÝÆ÷µÄ¶Ë¿ÚÓ³Éä¡£
# Éó²éÈÝÆ÷mynginxµÄ¶Ë¿ÚÓ³ÉäÇéÐΡ£ docker port mymysql
µÇ¼ºó¸´ÖÆ
ÈÝÆ÷rootfsÏÂÁî
commit
´ÓÈÝÆ÷½¨ÉèÒ»¸öеľµÏñ¡£²ÎÊý˵Ã÷£º
-a : Ìá½»µÄ¾µÏñ×÷Õߣ»
-c : ʹÓÃDockerfileÖ¸ÁîÀ´½¨Éè¾µÏñ£»
-m : ÌύʱµÄ˵Ã÷ÎÄ×Ö£»
-p : ÔÚcommitʱ£¬½«ÈÝÆ÷ÔÝÍ£¡£
# ½«ÈÝÆ÷a404c6c174a2 ÉúÑÄΪеľµÏñ,# ²¢Ìí¼ÓÌá½»ÈËÐÅÏ¢ºÍ˵Ã÷ÐÅÏ¢¡£ docker commit -a "guodong" -m "my db" a404c6c174a2 mymysql:v1
µÇ¼ºó¸´ÖÆ
cp
ÓÃÓÚÈÝÆ÷ÓëÖ÷»úÖ®¼äµÄÊý¾Ý¿½±´¡£²ÎÊý˵Ã÷£º
-L : ¼á³ÖÔ´Ä¿µÄÖеÄÁ´½Ó
# ½«Ö÷»ú/www/runoobĿ¼¿½±´µ½ÈÝÆ÷96f7f14e99abµÄ/wwwĿ¼Ï¡£ docker cp /www/runoob 96f7f14e99ab:/www/ # ½«Ö÷»ú/www/runoobĿ¼¿½±´µ½ÈÝÆ÷96f7f14e99abÖУ¬Ä¿Â¼ÖØÃüÃûΪwww¡£ docker cp /www/runoob 96f7f14e99ab:/www # ½«ÈÝÆ÷96f7f14e99abµÄ/wwwĿ¼¿½±´µ½Ö÷»úµÄ/tmpĿ¼ÖС£ docker cp 96f7f14e99ab:/www /tmp/
µÇ¼ºó¸´ÖÆ
diff
¼ì²éÈÝÆ÷ÀïÎļþ½á¹¹µÄ¸ü¸Ä¡£
# Éó²éÈÝÆ÷mymysqlµÄÎļþ½á¹¹¸ü¸Ä¡£ docker diff mymysql
µÇ¼ºó¸´ÖÆ
¾µÏñ¿ÍÕ»ÏÂÁî
login/logout
docker login : ÉÏ°¶µ½Ò»¸öDocker¾µÏñ¿ÍÕ»£¬ÈôÊÇδָ¶¨¾µÏñ¿ÍÕ»µØµã£¬Ä¬ÒÔΪ¹Ù·½¿ÍÕ» Docker Hubdocker logout :µÇ³öÒ»¸öDocker¾µÏñ¿ÍÕ»£¬ÈôÊÇδָ¶¨¾µÏñ¿ÍÕ»µØµã£¬Ä¬ÒÔΪ¹Ù·½¿ÍÕ» Docker Hub²ÎÊý˵Ã÷£º
-u : ÉÏ°¶µÄÓû§Ãû
-p : ÉÏ°¶µÄÃÜÂë
# ÉÏ°¶µ½Docker Hub docker login -u Óû§Ãû -p ÃÜÂë # µÇ³öDocker Hub docker logout
µÇ¼ºó¸´ÖÆ
pull
´Ó¾µÏñ¿ÍÕ»ÖÐÀÈ¡»òÕ߸üÐÂÖ¸¶¨¾µÏñ¡£²ÎÊý˵Ã÷£º
-a : ÀÈ¡ËùÓÐ tagged ¾µÏñ
¨Cdisable-content-trust : ºöÂÔ¾µÏñµÄУÑé,ĬÈÏ¿ªÆô
# ´ÓDocker HubÏÂÔØjava×îа澵Ïñ¡£ docker pull java # ´ÓDocker HubÏÂÔØREPOSITORYΪjavaµÄËùÓоµÏñ¡£ docker pull -a java
µÇ¼ºó¸´ÖÆ
push
½«ÍâµØµÄ¾µÏñÉÏ´«µ½¾µÏñ¿ÍÕ»,ÒªÏÈÉÏ°¶µ½¾µÏñ¿ÍÕ»¡£²ÎÊý˵Ã÷£º
¨Cdisable-content-trust : ºöÂÔ¾µÏñµÄУÑé,ĬÈÏ¿ªÆô
# ÉÏ´«ÍâµØ¾µÏñmyapache:v1µ½¾µÏñ¿ÍÕ»ÖС£ docker push myapache:v1
µÇ¼ºó¸´ÖÆ
search
´ÓDocker Hub²éÕÒ¾µÏñ¡£²ÎÊý˵Ã÷£º
¨Cautomated : Ö»Áгö automated buildÀàÐ͵ľµÏñ£»
¨Cno-trunc : ÏÔʾÍêÕûµÄ¾µÏñÐÎò£»
-f \ : ÁгöÖ¸¶¨Ìõ¼þµÄ¾µÏñ¡£
# ´Ó Docker Hub ²éÕÒËùÓоµÏñÃû°üÀ¨ java£¬²¢ÇÒÕä²ØÊý´óÓÚ 10 µÄ¾µÏñ docker search -f stars=10 java NAME DESCRIPTION STARS OFFICIAL AUTOMATED java Java is a concurrent, class-based... 1037 [OK] anapsix/alpine-java Oracle Java 8 (and 7) with GLIBC ... 115 [OK] develar/java 46 [OK]
µÇ¼ºó¸´ÖÆ
ÿÁвÎÊý˵Ã÷£º
NAME: ¾µÏñ¿ÍÕ»Ô´µÄÃû³Æ
DESCRIPTION: ¾µÏñµÄÐÎò
OFFICIAL: ÊÇ·ñ docker ¹Ù·½Ðû²¼
stars: ÀàËÆ Github ÄÚÀïµÄ star£¬ÌåÏÖµãÔÞ¡¢Ï²»¶µÄÒâ˼
ÁíÍâËÑË÷¹«ÖÚºÅGitHubÔ³ºǫ́»Ø¸´¡°×¬Ç®¡±£¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£
AUTOMATED: ×Ô¶¯¹¹½¨
ÍâµØ¾µÏñÖÎÀíÏÂÁî
images
ÁгöÍâµØ¾µÏñ¡£²ÎÊý˵Ã÷£º
-a : ÁгöÍâµØËùÓеľµÏñ£¨º¬ÖÐÐÄÓ³Ïñ²ã£¬Ä¬ÈÏÇéÐÎÏ£¬¹ýÂ˵ôÖÐÐÄÓ³Ïñ²ã£©£»
¨Cdigests : ÏÔʾ¾µÏñµÄÕªÒªÐÅÏ¢£»
-f : ÏÔʾ֪×ãÌõ¼þµÄ¾µÏñ£»
¨Cformat : Ö¸¶¨·µ»ØÖµµÄÄ£°åÎļþ£»
¨Cno-trunc : ÏÔʾÍêÕûµÄ¾µÏñÐÅÏ¢£»
-q : Ö»ÏÔʾ¾µÏñID¡£
# Éó²éÍâµØ¾µÏñÁÐ±í¡£ docker images # ÁгöÍâµØ¾µÏñÖÐREPOSITORYΪubuntuµÄ¾µÏñÁÐ±í¡£ docker images ubuntu
µÇ¼ºó¸´ÖÆ
rmi
ɾ³ýÍâµØÒ»¸ö»ò¶à¸ö¾µÏñ¡£²ÎÊý˵Ã÷£º
-f : Ç¿ÖÆɾ³ý£»
¨Cno-prune : ²»ÒƳý¸Ã¾µÏñµÄÀú³Ì¾µÏñ£¬Ä¬ÈÏÒƳý£»
ÁíÍ⣬ËÑË÷¹«ÖÚºÅLinux¾Í¸ÃÕâÑùѧºǫ́»Ø¸´¡°Linux¡±£¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£
# Ç¿ÖÆɾ³ýÍâµØ¾µÏñ guodong/ubuntu:v4¡£ docker rmi -f guodong/ubuntu:v4
µÇ¼ºó¸´ÖÆ
tag
±ê¼ÇÍâµØ¾µÏñ£¬½«Æä¹éÈëijһ¿ÍÕ»¡£
# ½«¾µÏñubuntu:15.10±ê¼ÇΪ runoob/ubuntu:v3 ¾µÏñ¡£ docker tag ubuntu:15.10 runoob/ubuntu:v3
µÇ¼ºó¸´ÖÆ
build
ÓÃÓÚʹÓà Dockerfile ½¨Éè¾µÏñ¡£²ÎÊý˵Ã÷£º
¨Cbuild-arg=[] : ÉèÖþµÏñ½¨ÉèʱµÄ±äÁ¿£»
¨Ccpu-shares : ÉèÖà cpu ʹÓÃȨÖØ£»
¨Ccpu-period : ÏÞÖÆ CPU CFSÖÜÆÚ£»
¨Ccpu-quota : ÏÞÖÆ CPU CFSÅä¶î£»
¨Ccpuset-cpus : Ö¸¶¨Ê¹ÓõÄCPU id£»
¨Ccpuset-mems : Ö¸¶¨Ê¹ÓõÄÄÚ´æ id£»
¨Cdisable-content-trust : ºöÂÔУÑ飬ĬÈÏ¿ªÆô£»
-f : Ö¸¶¨ÒªÊ¹ÓõÄDockerfile·¾¶£»
¨Cforce-rm : ÉèÖþµÏñÀú³ÌÖÐɾ³ýÖÐÐÄÈÝÆ÷£»
¨Cisolation : ʹÓÃÈÝÆ÷¸ôÀëÊÖÒÕ£»
¨Clabel=[] : ÉèÖþµÏñʹÓõÄÔªÊý¾Ý£»
-m : ÉèÖÃÄÚ´æ×î´óÖµ£»
¨Cmemory-swap : ÉèÖÃSwapµÄ×î´óֵΪÄÚ´æ+swap£¬”-1″ÌåÏÖ²»ÏÞswap£»
¨Cno-cache : ½¨Éè¾µÏñµÄÀú³Ì²»Ê¹Óûº´æ£»
¨Cpull : ʵÑéÈ¥¸üоµÏñµÄа汾£»
¨Cquiet, -q : Ç徲ģʽ£¬ÀֳɺóÖ»Êä³ö¾µÏñ ID£»
¨Crm : ÉèÖþµÏñÀֳɺóɾ³ýÖÐÐÄÈÝÆ÷£»
¨Cshm-size : ÉèÖÃ/dev/shmµÄ¾Þϸ£¬Ä¬ÈÏÖµÊÇ64M£»
¨Culimit : UlimitÉèÖá£
¨Csquash : ½« Dockerfile ÖÐËùÓеIJÙ×÷ѹËõΪһ²ã¡£
¨Ctag, -t: ¾µÏñµÄÃû×Ö¼°±êÇ©£¬Í¨³£ name:tag »òÕß name ÃûÌ㻿ÉÒÔÔÚÒ»´Î¹¹½¨ÖÐΪһ¸ö¾µÏñÉèÖöà¸ö±êÇ©¡£
¨Cnetwork: ĬÈÏ default¡£ÔÚ¹¹½¨Ê±´úÉèÖÃRUNÖ¸ÁîµÄÍøÂçģʽ
# ʹÓÃÄ¿½ñĿ¼µÄ Dockerfile ½¨Éè¾µÏñ£¬±êǩΪ runoob/ubuntu:v1 docker build -t runoob/ubuntu:v1 . # ʹÓÃURL github.com/creack/docker-firefox µÄ Dockerfile ½¨Éè¾µÏñ docker build github.com/creack/docker-firefox # ͨ¹ý -f DockerfileÎļþµÄλÖà ½¨Éè¾µÏñ docker build -f /path/to/a/Dockerfile .
µÇ¼ºó¸´ÖÆ
history
Éó²éÖ¸¶¨¾µÏñµÄ½¨ÉèÀúÊ·¡£²ÎÊý˵Ã÷£º
-H : ÒԿɶÁµÄÃûÌôòÓ¡¾µÏñ¾ÞϸºÍÈÕÆÚ£¬Ä¬ÒÔΪtrue£»
¨Cno-trunc : ÏÔʾÍêÕûµÄÌá½»¼Í¼£»
-q : ½öÁгöÌá½»¼Í¼ID¡£
# Éó²éÍâµØ¾µÏñ guodong/ubuntu:v3 µÄ½¨ÉèÀúÊ·¡£ docker history guodong/ubuntu:v3
µÇ¼ºó¸´ÖÆ
save
½«Ö¸¶¨¾µÏñÉúÑÄ³É tar ¹éµµÎļþ¡£²ÎÊý˵Ã÷£º
-o : Êä³öµ½µÄÎļþ¡£
# ½«¾µÏñ runoob/ubuntu:v3 ÌìÉú my_ubuntu_v3.tar Îĵµ docker save -o my_ubuntu_v3.tar runoob/ubuntu:v3
µÇ¼ºó¸´ÖÆ
load
µ¼ÈëʹÓà docker save ÏÂÁîµ¼³öµÄ¾µÏñ¡£²ÎÊý˵Ã÷£º
¨Cinput , -i : Ö¸¶¨µ¼ÈëµÄÎļþ£¬È¡´ú STDIN¡£
¨Cquiet , -q : ¾«¼òÊä³öÐÅÏ¢¡£
# µ¼Èë¾µÏñ docker load --input fedora.tar
µÇ¼ºó¸´ÖÆ
import
´Ó¹éµµÎļþÖн¨Éè¾µÏñ¡£²ÎÊý˵Ã÷£º
-c : Ó¦ÓÃdocker Ö¸ÁÉè¾µÏñ£»
-m : ÌύʱµÄ˵Ã÷ÎÄ×Ö£»
# ´Ó¾µÏñ¹éµµÎļþmy_ubuntu_v3.tar½¨Éè¾µÏñ£¬ÃüÃûΪrunoob/ubuntu:v4 docker import my_ubuntu_v3.tar runoob/ubuntu:v4
µÇ¼ºó¸´ÖÆ
»ù´¡°æ±¾ÐÅÏ¢ÏÂÁî
info
ÏÔʾ Docker ϵͳÐÅÏ¢£¬°üÀ¨¾µÏñºÍÈÝÆ÷Êý¡£
# Éó²édockerϵͳÐÅÏ¢¡£ docker info
µÇ¼ºó¸´ÖÆ
version
ÏÔʾ Docker °æ±¾ÐÅÏ¢¡£
docker version
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇÓ¢»ª£¡Docker ³£ÓÃÏÂÁî´óÈ«µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡