{"id":343,"date":"2025-06-28T20:14:32","date_gmt":"2025-06-28T12:14:32","guid":{"rendered":"https:\/\/www.xxiaoteng.cn\/?p=343"},"modified":"2026-05-11T21:22:24","modified_gmt":"2026-05-11T13:22:24","slug":"docker%e7%ae%a1%e7%90%86%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/www.xxiaoteng.cn\/?p=343","title":{"rendered":"docker\u7ba1\u7406\u547d\u4ee4"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"toc-0\">\u4e00\u3001docker\u5bb9\u5668\u7ba1\u7406<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-1\">1.1 \u5bb9\u5668\u67e5\u770b-ps\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u663e\u793a\u672c\u5730\u5bb9\u5668\u5217\u8868\uff0c\u4f46\u662f\u9ed8\u8ba4\u4e0d\u663e\u793a\u5173\u95ed\u7684\u5bb9\u5668\uff0c\u53ea\u663e\u793a\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668\uff0c\u9664\u975e\u52a0\u4e0a\u547d\u4ee4\u9009\u9879 -a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker ps [-a \u663e\u793a\u6240\u6709\u5bb9\u5668\uff0c\u9ed8\u8ba4\u53ea\u663e\u793a\u8fd0\u884c\u7684]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">root@wing ~]# docker ps<br>CONTAINER ID &nbsp; &nbsp;  IMAGE &nbsp; COMMAND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATED &nbsp;  STATUS &nbsp; &nbsp; PORTS &nbsp; &nbsp;  NAMES<br>8f4c3f823843 &nbsp;  centos  \"\/bin\/bash\"  3 seconds ago  Exited(0) 3 seconds ago &nbsp; &nbsp; centos7_6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-2\">1.2\u3001\u5bb9\u5668\u8be6\u7ec6\u4fe1\u606f-inspect\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u663e\u793a\u5bb9\u5668\u7684\u8be6\u7ec6\u4fe1\u606f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker inspect [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker inspect centos<br>[<br> &nbsp;  {<br> &nbsp; &nbsp; &nbsp;  \"Id\": \"sha256:0f3e07c0138fbe05abcb7a9cc7d63d9bd4c980c3f61fea5efa32e7c4217ef4da\",<br> &nbsp; &nbsp; &nbsp;  \"RepoTags\": [<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"centos:latest\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"wing_centos:v1\"<br> &nbsp; &nbsp; &nbsp;  ],<br> &nbsp; &nbsp; &nbsp;  \"RepoDigests\": [],<br> &nbsp; &nbsp; &nbsp;  \"Parent\": \"\",<br> &nbsp; &nbsp; &nbsp;  \"Comment\": \"\",<br> &nbsp; &nbsp; &nbsp;  \"Created\": \"2019-10-01T23:19:57.105928163Z\",<br> &nbsp; &nbsp; &nbsp;  \"Container\": \"711572e3c0c1ac06d5c13c4e668ec170b8ad8786b5f0949f884a5f7fd350d856\",<br> &nbsp; &nbsp; &nbsp;  \"ContainerConfig\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Hostname\": \"711572e3c0c1\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Domainname\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"User\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"AttachStdin\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"AttachStdout\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"AttachStderr\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Tty\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"OpenStdin\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"StdinOnce\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Env\": [<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ],<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Cmd\": [<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"\/bin\/sh\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"-c\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"#(nop) \",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"CMD [\\\"\/bin\/bash\\\"]\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ],<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"ArgsEscaped\": true,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Image\": \"sha256:c0bda62fdbad65a3c6a1843d293a3a47d8233115cc6d384e3cb07c53580a2b43\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Volumes\": null,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"WorkingDir\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Entrypoint\": null,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"OnBuild\": null,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Labels\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.build-date\": \"20190927\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.license\": \"GPLv2\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.name\": \"CentOS Base Image\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.schema-version\": \"1.0\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.vendor\": \"CentOS\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  },<br> &nbsp; &nbsp; &nbsp;  \"DockerVersion\": \"18.06.1-ce\",<br> &nbsp; &nbsp; &nbsp;  \"Author\": \"\",<br> &nbsp; &nbsp; &nbsp;  \"Config\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Hostname\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Domainname\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"User\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"AttachStdin\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"AttachStdout\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"AttachStderr\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Tty\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"OpenStdin\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"StdinOnce\": false,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Env\": [<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ],<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Cmd\": [<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"\/bin\/bash\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ],<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"ArgsEscaped\": true,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Image\": \"sha256:c0bda62fdbad65a3c6a1843d293a3a47d8233115cc6d384e3cb07c53580a2b43\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Volumes\": null,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"WorkingDir\": \"\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Entrypoint\": null,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"OnBuild\": null,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Labels\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.build-date\": \"20190927\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.license\": \"GPLv2\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.name\": \"CentOS Base Image\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.schema-version\": \"1.0\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"org.label-schema.vendor\": \"CentOS\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br> &nbsp; &nbsp; &nbsp;  },<br> &nbsp; &nbsp; &nbsp;  \"Architecture\": \"amd64\",<br> &nbsp; &nbsp; &nbsp;  \"Os\": \"linux\",<br> &nbsp; &nbsp; &nbsp;  \"Size\": 219583055,<br> &nbsp; &nbsp; &nbsp;  \"VirtualSize\": 219583055,<br> &nbsp; &nbsp; &nbsp;  \"GraphDriver\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Data\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"MergedDir\": \"\/var\/lib\/docker\/overlay2\/7e9695593c24efc2b9e7cbe8ee2ce7c299e8cde85d73668b94f91284554d3e57\/merged\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"UpperDir\": \"\/var\/lib\/docker\/overlay2\/7e9695593c24efc2b9e7cbe8ee2ce7c299e8cde85d73668b94f91284554d3e57\/diff\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"WorkDir\": \"\/var\/lib\/docker\/overlay2\/7e9695593c24efc2b9e7cbe8ee2ce7c299e8cde85d73668b94f91284554d3e57\/work\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  },<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Name\": \"overlay2\"<br> &nbsp; &nbsp; &nbsp;  },<br> &nbsp; &nbsp; &nbsp;  \"RootFS\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Type\": \"layers\",<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"Layers\": [<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"sha256:9e607bb861a7d58bece26dd2c02874beedd6a097c1b6eca5255d5eb0d2236983\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ]<br> &nbsp; &nbsp; &nbsp;  },<br> &nbsp; &nbsp; &nbsp;  \"Metadata\": {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"LastTagTime\": \"2019-11-15T05:18:05.72378385-05:00\"<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>]<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-3\">1.3\u3001\u5bb9\u5668\u521b\u5efa-run\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bb9\u5668\u521b\u5efa\u547d\u4ee4<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker run [options] \u955c\u50cf\u540d\u79f0<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u540e\u53f0\u6267\u884c\u5bb9\u5668<br>\u200b<br>[root@wing ~]# docker run -d --name centos7_6 centos <br>\u200b<br>#\u524d\u53f0\u6267\u884c\u7684\u5bb9\u5668<br>\u200b<br>[root@wing ~]# docker run -it --name centos7_5  centos \/bin\/bash<br>\u200b<br>[root@5a1f02b4041c \/]# <br>\u200b<br>-i \u4ea4\u4e92\u5f0f\u521b\u5efa<br>-t \u521b\u5efa\u4e00\u4e2a\u4f2a\u7ec8\u7aef<br>-d \u540e\u53f0\u6267\u884c<br>--name \u5bb9\u5668\u540d\u79f0<br>\/bin\/bash \u5728\u4f2a\u7ec8\u7aef\u4e2d\u6267\u884c\u7684\u547d\u4ee4<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-4\">1.4\u3001\u5bb9\u5668\u5220\u9664-rm\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5220\u9664\u4e00\u4e2a\u672c\u5730\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker rm [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID] [\u2013force]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker rm centos7_5<br>centos7_5<br>\u200b<br>\u9ed8\u8ba4\u5220\u9664\u7684\u5bb9\u5668\u5fc5\u987b\u662f\u5173\u95ed\u72b6\u6001\uff0c\u5efa\u8bae\u5982\u679c\u5e0c\u671b\u5220\u9664\u4e00\u4e2a\u8fd0\u884c\u7684\u5bb9\u5668\uff0c\u53ef\u4ee5\u5148\u5173\u95ed\u5728\u5220\u9664\u3002<br>\u5f53\u7136\u4e5f\u53ef\u4ee5\u5728\u540e\u9762\u76f4\u63a5\u52a0\u4e0a--force \u5f3a\u5236\u5220\u9664\u4e00\u4e2a\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-5\">1.5\u3001\u5bb9\u5668\u6267\u884c\u547d\u4ee4-exec\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u8fd0\u884c\u5bb9\u5668\u4e2d\u6267\u884c\u4e00\u4e2a\u547d\u4ee4\uff0c\u5982\u679c\u60f3\u5728\u5bb9\u5668\u4e2d\u6267\u884c\u4e00\u4e2a\u547d\u4ee4\uff0c\u90a3\u4e48\u8fd9\u4e2aexec\u547d\u4ee4\u5c31\u5f88\u6709\u7528\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker exec [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID] \u547d\u4ee4<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker exec centos7_6 ls \/<br>bin<br>dev<br>etc<br>home<br>lib<br>lib64<br>lost+found<br>media<br>mnt<br>opt<br>proc<br>root<br>run<br>sbin<br>srv<br>sys<br>tmp<br>usr<br>var<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-6\">1.6\u3001\u5bb9\u5668\u4fe1\u606f\u8f93\u51fa-attach\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u4e00\u4e2a\u8fd0\u884c\u5bb9\u5668\u7684\u6807\u51c6\u8f93\u51fa\u3001\u9519\u8bef\u8f93\u51fa\u3001\u6807\u51c6\u8f93\u5165\u8c03\u5165\u524d\u53f0 \u9ed8\u8ba4\u5bb9\u5668\u90fd\u4f1a\u5728\u540e\u53f0\u8fd0\u884c\uff0c\u5982\u679c\u4f60\u60f3\u8fdb\u5165\u5bb9\u5668\u5185\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u8be5\u547d\u4ee4\u3002\u8fd9\u6837\u4f60\u5c31\u53ef\u4ee5\u4ea4\u4e92\u5f0f\u7684\u5728\u5bb9\u5668\u4e2d\u6267\u884c\u547d\u4ee4\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker attach [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker attach centos7_6<br>\u200b<br>[root@128dc0ffc489 \/]# <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-7\">1.7\u3001\u5bb9\u5668\u542f\u52a8-start\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u542f\u52a8\u4e00\u4e2a\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker start [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker start centos7_6<br>centos7_6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-8\">1.8\u3001\u505c\u6b62\u4e00\u4e2a\u5bb9\u5668-stop\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u95ed\u4e00\u4e2a\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker stop [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker stop centos7_6<br>centos7_6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-9\">1.9\u3001\u91cd\u542f\u4e00\u4e2a\u5bb9\u5668-restart\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u91cd\u542f\u4e00\u4e2a\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker restart [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker restart centos7_6<br>centos7_6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-10\">1.10\u3001\u5bb9\u5668\u6302\u8d77-pause\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6302\u8d77\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5\uff1a <strong>docker pause [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker pause centos7_6<br>\u200b<br>centos7_6<br>\u200b<br>[root@wing ~]# docker ps<br>\u200b<br>CONTAINER ID &nbsp; &nbsp; IMAGE &nbsp; &nbsp; COMMAND &nbsp; &nbsp; CREATED  STATUS &nbsp;  PORTS  NAMES<br>128dc0ffc489  centos \"\/bin\/bash\" 19 minutes ago  Up 14 minutes (Paused) &nbsp;  centos7_6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-11\">1.11\u3001\u5bb9\u5668\u6062\u590d-unpause\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6062\u590d\u6302\u8d77\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker unpause [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker unpause centos7_6<br>centos7_6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-12\">1.12\u3001\u5bb9\u5668\u91cd\u547d\u540d-rename\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u91cd\u547d\u540d\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker rename \u5bb9\u5668\u540d\u79f0 \u5bb9\u5668\u65b0\u540d\u79f0<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker rename centos7_6 centos76<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-13\">1.13\u3001\u5bb9\u5668\u7aef\u53e3\u6620\u5c04\u4fe1\u606f-port\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u663e\u793a\u5bb9\u5668\u4e0e\u5bbf\u4e3b\u673a\u7684\u7aef\u53e3\u9690\u5c04\u4fe1\u606f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker port [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker port 32fd02f05446<br>5000\/tcp -&gt; 0.0.0.0:5000<br>\u200b<br>\u5bb9\u5668\u7684TCP 5000\u7aef\u53e3\u4e0e\u5bbf\u4e3b\u673a\u7684\u6240\u6709IP\u76845000\u7aef\u53e3\u7ed1\u5b9a<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-14\">1.14\u3001\u6740\u6b7b\u4e00\u4e2a\u6216\u591a\u4e2a\u5bb9\u5668-kill\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6740\u6b7b\u8fd0\u884c\u7684\u5bb9\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker kill [\u955c\u50cf\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker kill centos76<br>centos76<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-15\">1.15\u3001\u5bb9\u5668\u5bfc\u51fa-export\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u4e00\u4e2a\u5bb9\u5668\u5bfc\u51fa\u4e00\u4e2a\u955c\u50cf\u4e3a\u538b\u7f29\u6587\u4ef6<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker export -o \u5bfc\u51fa\u540e\u955c\u50cf\u6587\u4ef6\u540d [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID]<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker export -o wing_centos.tar centos76<br>\u200b<br>[root@wing ~]# ls<br>\u200b<br>anaconda-ks.cfg  centos_base.tar  Docker  wing_centos.tar<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-16\">1.16\u3001\u5bb9\u5668\u955c\u50cf\u5bfc\u5165\u5230\u955c\u50cf\u5e93-import\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u5bb9\u5668\u955c\u50cf\u5bfc\u5165\u5230\u955c\u50cf\u5e93<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker import \u955c\u50cf\u6587\u4ef6\u540d \u955c\u50cf\u540d:tag<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker import wing_centos.tar wing\/centos7_6:latest<br>sha256:659fb2fca656430822627685ba4f29d09ae619cd9f2b42ef52d47003c8af8d11<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-17\">1.17\u3001\u5c06\u5bb9\u5668\u751f\u6210\u955c\u50cf-commit\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06\u6539\u53d8\u540e\u7684\u5bb9\u5668\u76f4\u63a5\u53d8\u6210\u955c\u50cf\uff0c\u4e00\u822c\u6307\u7684\u662f\u5c01\u88c5\u597d\u4e1a\u52a1\u7684\u5bb9\u5668\uff0c\u76f4\u63a5\u5c01\u88c5\u6210\u955c\u50cf<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7528\u6cd5: <strong>docker commit [\u5bb9\u5668\u540d\u79f0\u6216\u8005ID] \u5bfc\u51fa\u540e\u955c\u50cf\u7684\u540d\u5b57:tag<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[root@wing ~]# docker commit  centos76 &nbsp; wing\/centos_7_6:v1<br>\u200b<br>sha256:1f078c1d94dd641c65495bd91d3e471593c5ec60ecbb4492cfa18a161448dd3a<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001docker\u5bb9\u5668\u7ba1\u7406 1.1 \u5bb9\u5668\u67e5\u770b-ps\u547d\u4ee4 \u663e\u793a\u672c\u5730\u5bb9\u5668\u5217\u8868\uff0c\u4f46\u662f\u9ed8\u8ba4\u4e0d\u663e\u793a\u5173\u95ed\u7684\u5bb9\u5668\uff0c\u53ea\u663e\u793a\u8fd0\u884c\u4e2d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-343","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343"}],"version-history":[{"count":1,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions\/344"}],"wp:attachment":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}