{"id":49903,"date":"2023-05-23T13:36:38","date_gmt":"2023-05-23T05:36:38","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=49903"},"modified":"2023-05-23T13:36:38","modified_gmt":"2023-05-23T05:36:38","slug":"docker-basic-control-1","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-basic-control-1.html","title":{"rendered":"Docker \u4ece\u5165\u95e8\u5230\u7cbe\u901a\uff08\u4e00\uff09\u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nDocker \u662f\u4e00\u4e2a\u80fd\u591f\u628a\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u81ea\u52a8\u90e8\u7f72\u5230\u5bb9\u5668\u7684\u5f00\u6e90\u5f15\u64ce\u3002\u5b83\u7531Docker\u516c\u53f8\u7684\u56e2\u961f\u7f16\u5199\uff0c\u57fa\u4e8eApache 2.0\u5f00\u6e90\u534f\u8bae\u6388\u6743\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u3001\u8f7b\u91cf\u7684\u5efa\u6a21\u65b9\u5f0f\uff0c\u4f7f\u5f00\u53d1\u751f\u547d\u5468\u671f\u66f4\u9ad8\u6548\u5feb\u901f\uff0c\u9f13\u52b1\u4e86\u9762\u5411\u670d\u52a1\u7684\u67b6\u6784\u8bbe\u8ba1\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\uff0c\u4e3a\u4ec0\u4e48\u8981\u7528 Docker?<\/strong><\/div>\n

Docker \u662f\u4e00\u4e2a\u80fd\u591f\u628a\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u81ea\u52a8\u90e8\u7f72\u5230\u5bb9\u5668\u7684\u5f00\u6e90\u5f15\u64ce\u3002\u5b83\u7531Docker\u516c\u53f8\u7684\u56e2\u961f\u7f16\u5199\uff0c\u57fa\u4e8eApache 2.0\u5f00\u6e90\u534f\u8bae\u6388\u6743\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u3001\u8f7b\u91cf\u7684\u5efa\u6a21\u65b9\u5f0f\uff0c\u4f7f\u5f00\u53d1\u751f\u547d\u5468\u671f\u66f4\u9ad8\u6548\u5feb\u901f\uff0c\u9f13\u52b1\u4e86\u9762\u5411\u670d\u52a1\u7684\u67b6\u6784\u8bbe\u8ba1\u3002Docker \u9879\u76ee\u7684\u76ee\u6807\u662f\u5b9e\u73b0\u8f7b\u91cf\u7ea7\u7684\u64cd\u4f5c\u7cfb\u7edf\u865a\u62df\u5316\u89e3\u51b3\u65b9\u6848\u3002 Docker \u7684\u57fa\u7840\u662f Linux \u5bb9\u5668(LXC)\u7b49\u6280\u672f\u3002\u5728 LXC \u7684\u57fa\u7840\u4e0a Docker \u8fdb\u884c\u4e86\u8fdb\u4e00\u6b65\u7684\u5c01\u88c5\uff0c\u8ba9\u7528\u6237\u4e0d\u9700\u8981\u53bb\u5173\u5fc3\u5bb9\u5668\u7684\u7ba1\u7406\uff0c\u4f7f\u5f97\u64cd\u4f5c\u66f4\u4e3a\u7b80\u4fbf\u3002\u7528\u6237\u64cd\u4f5c Docker \u7684\u5bb9\u5668\u5c31\u50cf\u64cd\u4f5c\u4e00\u4e2a\u5feb\u901f\u8f7b\u91cf\u7ea7\u7684\u865a\u62df\u673a\u4e00\u6837\u7b80\u5355\u3002<\/p>\n

Docker \u7684\u7279\u70b9\uff1a<\/strong><\/span><\/div>\n

1\uff0c\u66f4\u5feb\u901f\u7684\u4ea4\u4ed8\u548c\u90e8\u7f72
\n2\uff0c\u66f4\u9ad8\u6548\u7684\u865a\u62df\u5316
\n3\uff0c\u66f4\u8f7b\u677e\u7684\u8fc1\u79fb\u548c\u6269\u5c55
\n4\uff0c\u66f4\u7b80\u5355\u7684\u7ba1\u7406<\/p>\n

\u5bb9\u5668\u6280\u672f\u4e0e\u4f20\u7edf\u865a\u62df\u673a\u6027\u80fd\u5bf9\u6bd4\uff1a<\/strong><\/span><\/div>\n

\"Docker<\/a><\/p>\n

Docker\u4e0e\u865a\u62df\u673a\u5efa\u6784\u5bf9\u6bd4<\/p>\n

\"Docker<\/p>\n

Docker \u5bb9\u5668\u672c\u8d28\u4e0a\u662f\u5bbf\u4e3b\u673a\u4e0a\u7684\u4e00\u4e2a\u8fdb\u7a0b\u3002Docker \u901a\u8fc7 namespace \u5b9e\u73b0\u4e86\u8d44\u6e90\u9694\u79bb\uff0c\u901a\u8fc7 cgroups \u5b9e\u73b0\u4e86\u8d44\u6e90\u7684\u9650\u5236\uff0c\u901a\u8fc7\u5199\u65f6\u590d\u5236\u673a\u5236(copy-on-write)\u5b9e\u73b0\u4e86\u9ad8\u6548\u7684\u6587\u4ef6\u64cd\u4f5c\u3002<\/p>\n

Docker\u6709\u4e94\u4e2a\u547d\u540d\u7a7a\u95f4\uff1a<\/strong><\/span><\/div>\n

\u8fdb\u7a0b\u3001\u7f51\u7edc\u3001\u6302\u8f7d\u3001\u5bbf\u4e3b\u548c\u5171\u4eab\u5185\u5b58
\n\u4e3a\u4e86\u9694\u79bb\u6709\u95ee\u9898\u7684\u5e94\u7528\uff0cDocker\u8fd0\u7528Namespace\u5c06\u8fdb\u7a0b\u9694\u79bb\uff0c\u4e3a\u8fdb\u7a0b\u6216\u8fdb\u7a0b\u7ec4\u521b\u5efa\u5df2\u9694\u79bb\u7684\u8fd0\u884c\u7a7a\u95f4\uff0c\u4e3a\u8fdb\u7a0b\u63d0\u4f9b\u4e0d\u540c\u7684\u547d\u540d\u7a7a\u95f4\u89c6\u56fe\u3002\u8fd9\u6837\uff0c\u6bcf\u4e00\u4e2a\u9694\u79bb\u51fa\u6765\u7684\u8fdb\u7a0b\u7ec4\uff0c\u5bf9\u5916\u5c31\u8868\u73b0\u4e3a\u4e00\u4e2acontainer(\u5bb9\u5668)\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cDocker\u8ba9\u7528\u6237\u8bef\u4ee5\u4e3a\u81ea\u5df1\u5360\u636e\u4e86\u5168\u90e8\u8d44\u6e90\uff0c\u4f46\u8fd9\u5e76\u4e0d\u662f\u201d\u865a\u62df\u673a\u201d\u3002<\/p>\n

Docker \u4e2d\u7684\u4e09\u4e2a\u6982\u5ff5\uff1a\u955c\u50cf\uff0c\u5bb9\u5668\uff0c\u4ed3\u5e93<\/strong><\/span><\/div>\n

1\u3001\u955c\u50cf(image)\uff1aDocker \u955c\u50cf\u5c31\u662f\u4e00\u4e2a\u53ea\u8bfb\u7684\u6a21\u677f\uff0c\u955c\u50cf\u53ef\u4ee5\u7528\u6765\u521b\u5efa Docker \u5bb9\u5668\u3002Docker \u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f88\u7b80\u5355\u7684\u673a\u5236\u6765\u521b\u5efa\u955c\u50cf\u6216\u8005\u66f4\u65b0\u73b0\u6709\u7684\u955c\u50cf\uff0c\u7528\u6237\u751a\u81f3\u53ef\u4ee5\u76f4\u63a5\u4ece\u5176\u4ed6\u4eba\u90a3\u91cc\u4e0b\u8f7d\u4e00\u4e2a\u5df2\u7ecf\u505a\u597d\u7684\u955c\u50cf\u6765\u76f4\u63a5\u4f7f\u7528\u3002
\n\u955c\u50cf\u662f\u4e00\u79cd\u6587\u4ef6\u7ed3\u6784\u3002Dockerfile\u4e2d\u7684\u6bcf\u6761\u547d\u4ee4\u90fd\u4f1a\u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5c42\u6b21\u7ed3\u6784\uff0c\u6587\u4ef6\u7cfb\u7edf\u5728\u8fd9\u4e9b\u5c42\u6b21\u4e0a\u6784\u5efa\u8d77\u6765\uff0c\u955c\u50cf\u5c31\u6784\u5efa\u4e8e\u8fd9\u4e9b\u8054\u5408\u7684\u6587\u4ef6\u7cfb\u7edf\u4e4b\u4e0a\u3002Docker\u5b98\u65b9\u7f51\u7ad9\u4e13\u95e8\u6709\u4e00\u4e2a\u9875\u9762\u6765\u5b58\u50a8\u6240\u6709\u53ef\u7528\u7684\u955c\u50cf\uff0c\u7f51\u5740\u662f\uff1aindex.docker.io\u3002
\n2\u3001\u5bb9\u5668( Container)\uff1a\u5bb9\u5668\u662f\u4ece\u955c\u50cf\u521b\u5efa\u7684\u8fd0\u884c\u5b9e\u4f8b\u3002\u5b83\u53ef\u4ee5\u88ab\u542f\u52a8\u3001\u5f00\u59cb\u3001\u505c\u6b62\u3001\u5220\u9664\u3002\u6bcf\u4e2a\u5bb9\u5668\u90fd\u662f\u76f8\u4e92\u9694\u79bb\u7684\u3001\u4fdd\u8bc1\u5b89\u5168\u7684\u5e73\u53f0\u3002\u53ef\u4ee5\u628a\u5bb9\u5668\u770b\u505a\u662f\u4e00\u4e2a\u7b80\u6613\u7248\u7684 Linux \u73af\u5883\uff0cDocker \u5229\u7528\u5bb9\u5668\u6765\u8fd0\u884c\u5e94\u7528\u3002\u955c\u50cf\u662f\u53ea\u8bfb\u7684\uff0c\u5bb9\u5668\u5728\u542f\u52a8\u7684\u65f6\u5019\u521b\u5efa\u4e00\u5c42\u53ef\u5199\u5c42\u4f5c\u4e3a\u6700\u4e0a\u5c42\u3002
\n3\u3001\u4ed3\u5e93\uff1a\u4ed3\u5e93\u662f\u96c6\u4e2d\u5b58\u653e\u955c\u50cf\u6587\u4ef6\u7684\u573a\u6240\uff0c\u4ed3\u5e93\u6ce8\u518c\u670d\u52a1\u5668(Registry)\u4e0a\u5f80\u5f80\u5b58\u653e\u7740\u591a\u4e2a\u4ed3\u5e93\uff0c\u6bcf\u4e2a\u4ed3\u5e93\u4e2d\u53c8\u5305\u542b\u4e86\u591a\u4e2a\u955c\u50cf\uff0c\u6bcf\u4e2a\u955c\u50cf\u6709\u4e0d\u540c\u7684\u6807\u7b7e(tag)\u3002\u76ee\u524d\uff0c\u6700\u5927\u7684\u516c\u5f00\u4ed3\u5e93\u662f Docker Hub\uff0c\u5b58\u653e\u4e86\u6570\u91cf\u5e9e\u5927\u7684\u955c\u50cf\u4f9b\u7528\u6237\u4e0b\u8f7d\u3002
\nDocker\u4ed3\u5e93\u7528\u6765\u4fdd\u5b58\u6211\u4eec\u7684images\uff0c\u5f53\u6211\u4eec\u521b\u5efa\u4e86\u81ea\u5df1\u7684image\u4e4b\u540e\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528push\u547d\u4ee4\u5c06\u5b83\u4e0a\u4f20\u5230\u516c\u6709\u6216\u8005\u79c1\u6709\u4ed3\u5e93\uff0c\u8fd9\u6837\u4e0b\u6b21\u8981\u5728\u53e6\u5916\u4e00\u53f0\u673a\u5668\u4e0a\u4f7f\u7528\u8fd9\u4e2aimage\u65f6\u5019\uff0c\u53ea\u9700\u8981\u4ece\u4ed3\u5e93\u4e0apull\u4e0b\u6765\u5c31\u53ef\u4ee5\u4e86\u3002Docker \u4ed3\u5e93\u7684\u6982\u5ff5\u8ddf Git \u7c7b\u4f3c\uff0c\u6ce8\u518c\u670d\u52a1\u5668\u53ef\u4ee5\u7406\u89e3\u4e3a GitHub \u8fd9\u6837\u7684\u6258\u7ba1\u670d\u52a1\u3002<\/p>\n

\u4e8c\uff0c\u5b89\u88c5 Docker<\/strong><\/div>\n

\u524d\u63d0\u6761\u4ef6\uff1aDocker\u8fd0\u884c\u5bf9\u5185\u6838\u8981\u6c42\u6bd4\u8f83\u9ad8\uff0c\u56e0\u6b64\u4e00\u822c\u5efa\u8bae\u76f4\u63a5\u5728Ubuntu\u8fd9\u6837\u7684\u5e73\u53f0\u8fd0\u884c\u3002\u4f46\u4f5c\u4e3a\u4e00\u4e2a\u5bb9\u5668\u6807\u51c6\uff0cDocker\u4e5f\u662f\u652f\u6301\u5176\u4ed6\u5982CentOS, Mac OS X, Windows\u7b49\u5e73\u53f0\u3002\u76ee\u524dDocker\u652f\u6301\u4ee5\u4e0b\u7248\u672cCentOS:CentOS 7(64\u4f4d)CentOS 6.5(64\u4f4d)\u53ca\u4ee5\u540e\u5728\u8fd0\u884cCentOS 6.5\u53ca\u4ee5\u540e\u7248\u672c\u65f6\uff0c\u9700\u8981\u5185\u6838\u7248\u672c>=2.6.32-431\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u5185\u6838\u5305\u542b\u4e86\u8fd0\u884cDocker\u7684\u4e00\u4e9b\u7279\u5b9a\u4fee\u6539\u3002
\nDocker\u9ed8\u8ba4\u4f7f\u7528AUFS\u4f5c\u4e3a\u5b58\u50a8\u9a71\u52a8\uff0c\u4f46\u662fAUFS\u5e76\u6ca1\u6709\u88ab\u5305\u62ec\u5728Linux\u7684\u4e3b\u7ebf\u5185\u6838\u4e2d\u3002CentOS\u4e2d\u53ef\u4ee5\u4f7f\u7528Device Mapper\u4f5c\u4e3a\u5b58\u50a8\u9a71\u52a8\uff0c\u8fd9\u662f\u57282.6.9\u5185\u6838\u7248\u672c\u5f15\u5165\u7684\u65b0\u529f\u80fd\u3002\u6211\u4eec\u9700\u8981\u5148\u786e\u8ba4\u662f\u5426\u542f\u7528\u8be5\u529f\u80fd:<\/p>\n

CentOS 7\u5b89\u88c5<\/strong><\/span><\/div>\n

Docker RPM\u5305\u5df2\u7ecf\u5305\u542b\u5728CentOS-Extra\u4ed3\u5e93\u4e2d\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528Yum\u5b89\u88c5:<\/p>\n

#\u00a0yum\u00a0install\u00a0docker\r\n<\/pre>\n
CentOS 6.6\u5b89\u88c5<\/strong><\/span><\/div>\n

\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cCentOS6.6\u4e2d\uff0c\u5df2\u7ecf\u6709\u4e00\u4e2a\u540c\u540ddocker\u7684\u53ef\u6267\u884c\u7cfb\u7edf\u7a0b\u5e8f\u5305\u3002\u6240\u4ee5Docker RPM\u5305\u547d\u540d\u4e3adocker-io\uff0c\u6211\u4eec\u5148\u5378\u6389docker\u3002<\/p>\n

#\u00a0yum\u00a0-y\u00a0remove\u00a0docker\r\n<\/pre>\n

\u7b2c\u4e09\u6b65 Install Docker-IO<\/p>\n

#\u00a0yum\u00a0-y\u00a0install\u00a0docker-io\r\n<\/pre>\n

\u8fd9\u6837\u5b8c\u6210\u4e86Docker\u7684\u5b89\u88c5\u3002<\/p>\n

#\u00a0\/etc\/init.d\/docker\u00a0start\u00a0#\u542f\u52a8docker\r\n#\u00a0docker\u00a0info\u00a0#\u67e5\u770b\u00a0docker\u00a0\u57fa\u672c\u4fe1\u606f\r\n<\/pre>\n
\u4e09\uff0c Docker \u57fa\u672c\u64cd\u4f5c<\/strong><\/div>\n
#\u00a0docker\u00a0search\u00a0centos\u00a0#\u641c\u7d22\u5bb9\u5668\r\n#\u00a0docker\u00a0pull\u00a0centos\u00a0#\u4e0b\u8f7d\u5bb9\u5668\r\n#\u00a0docker\u00a0images\u00a0#\u67e5\u770b\u5f53\u524d\u5b58\u5728\u7684\u955c\u50cf\r\n#\u00a0docker\u00a0run\u00a0centos\u00a0\/bin\/echo\u00a0'hello\u00a0world'\u00a0#\u8fd0\u884c\u4e00\u6761\u547d\u4ee4\u540e\u76f4\u63a5\u9000\u51fa\r\n#\u00a0docker\u00a0run\u00a0--name\u00a0mydocker\u00a0-it\u00a0centos\u00a0\/bin\/bash\u00a0#\u8fdb\u5165docker\u5bb9\u5668\r\n-t \u9009\u9879\u8ba9Docker\u5206\u914d\u4e00\u4e2a\u4f2a\u7ec8\u7aef\uff08pseudo-tty\uff09\u5e76\u7ed1\u5b9a\u5230\u5bb9\u5668\u7684\u6807\u51c6\u8f93\u5165\u4e0a\uff0c\r\n-i\u00a0\u5219\u8ba9\u5bb9\u5668\u7684\u6807\u51c6\u8f93\u5165\u4fdd\u6301\u6253\u5f00\u3002\r\n\u2013name\u00a0\u4f7f\u7528\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u540d\u5b57\r\n#\u00a0docker\u00a0run\u00a0-d\u00a0--name\u00a0mynginx\u00a0nginx\u00a0#\u542f\u52a8nginx\u955c\u50cf\uff0c\u6ca1\u6709\u4f1a\u81ea\u52a8pull\r\n#\u00a0docker\u00a0stop\u00a0bfd094233f96\u00a0#\u505c\u6b62\u4e00\u4e2a\u5bb9\u5668\uff0c\u6839\u636e\u5bb9\u5668\u00a0id\u00a0\u8fdb\u884c\u5220\u9664\r\n#\u00a0docker\u00a0rm\u00a0bfd094233f96\u00a0#\u5220\u9664\u4e00\u4e2a\u5bb9\u5668\r\n#\u00a0docker\u00a0attach\u00a0d20f3dc6cd92\u00a0#\u8fdb\u5165\u4e00\u4e2a\u6b63\u5728\u8fd0\u884c\u7684\u5bb9\u5668\r\n<\/pre>\n

\u6b64\u547d\u4ee4\u4e0d\u592a\u597d\u7528\uff0c\u5efa\u8bae\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165\u5bb9\u5668\uff1a<\/p>\n

[root@localhost\u00a0docker]#\u00a0docker\u00a0inspect\u00a0--format\u00a0\"{{.State.Pid}}\"\u00a0mynginx\u00a0#\u83b7\u53d6\u5bb9\u5668pid\r\n19769\r\n[root@localhost\u00a0docker]#\u00a0nsenter\u00a0--target\u00a019769\u00a0--mount\u00a0--uts\u00a0--ipc\u00a0--net\u00a0--pid\u00a0#\u8fdb\u5165\u5bb9\u5668(\u63a8\u8350\u65b9\u6cd5)\r\n#\u00a0docker\u00a0run\u00a0-d\u00a0-p\u00a091:80\u00a0--name\u00a0mynginx2\u00a0nginx\u00a0#\u00a0-p\u00a0\u6307\u5b9a\u7aef\u53e3\u6620\u5c04\uff0c\u5c0680\u6620\u5c04\u4e3ahost\u768491\r\n<\/pre>\n

\u5b58\u50a8\u955c\u50cf\uff1a<\/p>\n

#\u00a0docker\u00a0save\u00a0-o\u00a0ubuntu_14.04.tar\u00a0ubuntu:14.04\r\n<\/pre>\n

\u8f7d\u5165\u955c\u50cf\uff1a<\/p>\n

#\u00a0docker\u00a0load\u00a0<\u00a0ubuntu_14.04.tar\u00a0\u6216\u8005\u4f7f\u7528\r\n#\u00a0cat\u00a0ubuntu.tar\u00a0|\u00a0docker\u00a0import\u00a0-\u00a0test\/ubuntu:v1.0\r\n<\/pre>\n

\u79fb\u9664\u672c\u5730\u955c\u50cf\uff1a<\/p>\n

#\u00a0docker\u00a0rmi\u00a0training\/sinatra\r\n<\/pre>\n

\u6e05\u7406\u6240\u6709\u672a\u6253\u8fc7\u6807\u7b7e\u7684\u672c\u5730\u955c\u50cf\uff1a<\/p>\n

#\u00a0docker\u00a0rmi\u00a0$(docker\u00a0images\u00a0-q\u00a0-f\u00a0\"dangling=true\")\r\n\u5176\u4e2d\u00a0-q\u00a0\u548c\u00a0-f\u00a0\u662f\u00a0quiet\uff0c\u2013filter\u00a0\u7684\u7f29\u5199,\u00a0\u5b8c\u6574\u7684\u547d\u4ee4\u5176\u5b9e\u53ef\u4ee5\u5199\u7740\u4e0b\u9762\u8fd9\u6837\uff0c\u662f\u4e0d\u662f\u66f4\u5bb9\u6613\u7406\u89e3\u4e00\u70b9\uff1f\r\n#\u00a0docker\u00a0rmi\u00a0$(docker\u00a0images\u00a0--quiet\u00a0--filter\u00a0\"dangling=true\")\r\n\u6ce8\uff1a\u00a0\u5bb9\u5668\u662f\u5426\u4f1a\u957f\u4e45\u8fd0\u884c\uff0c\u662f\u548cdocker\u00a0run\u6307\u5b9a\u7684\u547d\u4ee4\u6709\u5173\uff0c\u548c\u00a0-d\u00a0\u53c2\u6570\u65e0\u5173\u3002\r\n<\/pre>\n

\u8981\u83b7\u53d6\u5bb9\u5668\u7684\u8f93\u51fa\u4fe1\u606f\uff0c\u53ef\u4ee5\u901a\u8fc7 docker logs \u547d\u4ee4\u3002<\/p>\n

#\u00a0docker\u00a0logs\u00a0[container\u00a0ID\u00a0or\u00a0NAMES]\r\n<\/pre>\n

\u5220\u9664\u5bb9\u5668\uff1a<\/p>\n

#\u00a0docker\u00a0rm\u00a0\u9ed8\u8ba4\u5e76\u4e0d\u4f1a\u5220\u9664\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668\r\n<\/pre>\n

\u6709\u5173\u5bb9\u5668\u548c\u955c\u50cf\u7684\u5e95\u5c42\u4fe1\u606f:<\/p>\n

#\u00a0docker\u00a0inspect\u00a0container\/image\r\n<\/pre>\n

\u53ef\u4ee5\u67e5\u770b\uff1a
\n\u5bb9\u5668\u5b9e\u4f8b\u7684IP\u5730\u5740\u7aef\u53e3\u7ed1\u5b9a\u5217\u8868
\n\u7279\u5b9a\u7aef\u53e3\u6620\u5c04\u7684\u641c\u7d22
\n\u6536\u96c6\u914d\u7f6e\u7684\u8be6\u7ec6\u4fe1\u606f
\n\u4ece\u5bb9\u5668\u5185\u590d\u5236\u6587\u4ef6\u5230\u6307\u5b9a\u7684\u8def\u5f84\u4e0a\uff1a<\/p>\n

docker\u00a0cp\u00a0container:path\u00a0hostpath\r\n<\/pre>\n

\u4f7f\u7528Dockerfile\u6765\u6784\u5efa\u955c\u50cf\uff1a<\/p>\n

docker\u00a0build\u00a0[options]\u00a0PATH\u00a0|\u00a0URL\r\n\u2013rm=true\u8868\u793a\u6784\u5efa\u6210\u529f\u540e\uff0c\u79fb\u9664\u6240\u6709\u4e2d\u95f4\u5bb9\u5668\r\n\u2013no-cache=false\u8868\u793a\u5728\u6784\u5efa\u8fc7\u7a0b\u4e2d\u4e0d\u4f7f\u7528\u7f13\u5b58\r\n<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/os.51cto.com\/art\/201701\/527418.htm<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/docker-basic-control-1.html<\/a>\u7f16\u8f91\u5458\uff1a\u5218\u5cf0\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

 \u4e00\uff0c\u4e3a\u4ec0\u4e48\u8981\u7528 Docker?Docker \u662f\u4e00\u4e2a\u80fd\u591f\u628a\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u81ea\u52a8\u90e8\u7f72\u5230\u5bb9\u5668\u7684\u5f00\u6e90\u5f15\u64ce\u3002\u5b83\u7531Docker\u516c\u53f8\u7684\u56e2\u961f\u7f16\u5199\uff0c\u57fa\u4e8eApache 2.0\u5f00\u6e90\u534f\u8bae\u6388\u6743\u3002\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u3001\u8f7b\u91cf\u7684\u5efa\u6a21\u65b9\u5f0f\uff0c\u4f7f\u5f00\u53d1\u751f\u547d\u5468\u671f\u66f4\u9ad8\u6548\u5feb\u901f\uff0c\u9f13\u52b1\u4e86\u9762\u5411\u670d\u52a1\u7684\u67b6\u6784\u8bbe\u8ba1\u3002Docker \u9879\u76ee\u7684\u76ee\u6807\u662f\u5b9e\u73b0\u8f7b\u91cf\u7ea7\u7684\u64cd\u4f5c\u7cfb\u7edf\u865a\u62df\u5316\u89e3\u51b3\u65b9\u6848\u3002 Docker \u7684\u57fa\u7840\u662f Linux \u5bb9\u5668(LXC)\u7b49\u6280\u672f\u3002\u5728 LXC \u7684\u57fa\u7840\u4e0a Docker \u8fdb\u884c\u4e86\u8fdb\u4e00\u6b65\u7684\u5c01\u88c5\uff0c\u8ba9\u7528\u6237\u4e0d\u9700\u8981\u53bb\u5173\u5fc3\u5bb9\u5668\u7684\u7ba1\u7406\uff0c\u4f7f\u5f97\u64cd\u4f5c\u66f4\u4e3a\u7b80\u4fbf\u3002\u7528\u6237\u64cd\u4f5c Docker \u7684\u5bb9\u5668\u5c31\u50cf\u64cd\u4f5c\u4e00\u4e2a\u5feb\u901f\u8f7b\u91cf\u7ea7\u7684\u865a\u62df\u673a\u4e00\u6837\u7b80\u5355\u3002<\/p>\n","protected":false},"author":116,"featured_media":45353,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-49903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/49903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/116"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=49903"}],"version-history":[{"count":9,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/49903\/revisions"}],"predecessor-version":[{"id":273115,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/49903\/revisions\/273115"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/45353"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=49903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=49903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=49903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}