{"id":532127,"date":"2021-09-05T09:00:08","date_gmt":"2021-09-05T01:00:08","guid":{"rendered":"http:\/\/4563.org\/?p=532127"},"modified":"2021-09-05T09:00:08","modified_gmt":"2021-09-05T01:00:08","slug":"docker%e5%82%bb%e7%93%9c%e4%bd%bf%e7%94%a8%e9%80%9f%e6%88%90","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=532127","title":{"rendered":"Docker\u50bb\u74dc\u4f7f\u7528\u901f\u6210"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>sRGB<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>Docker\u50bb\u74dc\u4f7f\u7528\u901f\u6210<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 sRGB \u4e8e 2021-9-4 16:49 \u7f16\u8f91 <\/p>\n<p> # Docker \u4e00\u952e\u5b89\u88c5\u547d\u4ee4<br \/>  curl -fsSLo- get.docker.com | \/bin\/sh<\/p>\n<p>  # \u8fd0\u884c hello-world \u68c0\u67e5Docker\u5f15\u64ce\u662f\u5426\u5b89\u88c5<br \/>  docker run hello-world<\/p>\n<p>  # \u8fd0\u884c\u4e00\u4e2a Ubuntu \u5bb9\u5668<br \/>  docker run -it ubuntu bash<\/p>\n<p>  # \u663e\u793a\u6240\u6709\u7684\u5bb9\u5668<br \/>  docker ps -a<\/p>\n<p>  # \u663e\u793a\u672c\u673a\u955c\u50cf<br \/>  docker images<\/p>\n<p>  # \u67e5\u770bUbuntu\u955c\u50cf\u7684\u5386\u53f2<br \/>  docker history hello-world<\/p>\n<p>  # \u67e5\u770b\u955c\u50cf\u7684\u5386\u53f2<br \/>  docker history ubuntu<\/p>\n<p>  #\u5220\u9664\u6240\u6709\u5bb9\u5668<br \/>  docker rm-f$(docker ps -qa)<\/p>\n<p>  #\u5220\u9664\u6240\u6709\u955c\u50cf<br \/>  docker rmi -f$(docker images -qa)<\/p>\n<p>  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>  # \u56fd\u5185\u4f7f\u7528\u963f\u91cc\u4e91\u955c\u50cf<br \/>  wget get.docker.com -O get.docker.sh<br \/>  bashget.docker.sh&#8211;mirror Aliyun<\/p>\n<p>  # \u4f7f\u7528\u56fd\u5185\u955c\u50cf\uff0c\u663e\u793adeb\u5305 \u6e90\u4e3a mirrors.aliyun.com<br \/>  cat\/etc\/apt\/sources.list.d\/docker.list<br \/>  deb  https:\/\/mirrors.aliyun.com\/docker-ce\/linux\/debian buster stable<\/p>\n<p>  \u955c\u50cf\u4e0b\u8f7d\u4fee\u6539 vim \/etc\/docker\/daemon.json \u6dfb\u52a0 \u56fd\u5185\u6e90\uff0c\u7f51\u4e0a\u53ef\u4ee5\u67e5<\/p>\n<p>  \u9650\u5236\u65e5\u5fd7\u5927\u5c0f\uff0c vim \/etc\/docker\/daemon.json\u91cc\u8bbe\u7f6e<br \/>  \u6ca1\u6709\u53bb\u7528\u8fc7\uff0c\u4f7f\u7528\u811a\u672c \u81ea\u52a8\u5220\u9664\u4e5f\u662f\u53ef\u4ee5\u7684<\/p>\n<p>  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>  Docker \u4e0d\u662f\u865a\u62df\u673a\uff0c\u6240\u4ee5\u4f7f\u7528 htop \u5de5\u5177\uff0c\u662f\u53ef\u4ee5\u770b\u5230\u5bb9\u5668\u4e2d\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u8fd0\u884c\u7684\u670d\u52a1\u7a0b\u5e8f\u5b9e\u9645\u8fd8\u662f\u5728\u5bbf\u4e3b\u673a\u4e0a\u7684\uff0c\u53ea\u662f Docker \u5bb9\u5668\u6302\u8f7d\u4e86\u865a\u62df\u7684\u6587\u4ef6\u7cfb\u7edf\uff0cDocker\u4e2d\u7684\u7a0b\u5e8f\u662f\u548c\u5bbf\u4e3b\u673a\u5176\u4ed6\u7a0b\u5e8f \u6587\u4ef6\u7cfb\u7edf\u9694\u79bb\u7684\u3002<\/p>\n<p>  https:\/\/s3.bmp.ovh\/imgs\/2021\/09\/d0f92780aa4e7ae4.png<\/p>\n<p>  \u5982\u56fe\u4f7f\u7528\u7b80\u5355\u7684\u547d\u4ee4\uff0c\u53ef\u4ee5 \u8fdb\u5165 \u4e00\u4e2a\u5f53\u524d\u6d3b\u52a8\u7684\u5bb9\u5668\u7684 root \u76ee\u5f55\uff0c\u53ef\u4ee5\u770b\u5230\/var\/lib\/docker\/overlay2\/ed3&#8230;.. \/merged \u662f\u8fd9\u4e2a\u5bb9\u5668\u7684 \/ \u6839\u76ee\u5f55<\/p>\n<p>  df -h<br \/>  cd \/var\/lib\/docker\/overlay2\/ed3b19ce3a1402bd9a09ccde057145129714e5e70e7f6255e3d96e73feb9b50e\/merged<br \/>  ls<\/p>\n<p>  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>  docker\u5b89\u88c5\u540e\u67092\u4e2a\u91cd\u8981\u76ee\u5f55\/var\/lib\/docker\/containers&nbsp; &nbsp;\/var\/lib\/docker\/overlay2&nbsp; &nbsp; <\/p>\n<p>  docker ps -a&nbsp; &nbsp;\u8fd0\u884c\u540e \u4f1a\u663e\u793aCONTAINER ID&lt; ba5148927a1e&gt;&nbsp; &nbsp; ba5148927a1e \u5c31\u662f hello-world \u8fd9\u4e2a\u5bb9\u5668\u7684 ID<br \/>  \/var\/lib\/docker\/containers\/ba5148927a1e98322f8628650e8ef3b3ddd38e88bb59669dadf82433e932be7a&nbsp; &nbsp; (ID\u524d\u7f00\u7684\u8fd9\u4e2a\u957f\u76ee\u5f55\u5c31\u8fd8\u662f\u5bb9\u5668\u76ee\u5f55)<br \/>  \u91cc\u9762\u4fdd\u5b58\u4e86\u8fd9\u4e2a\u5bb9\u5668\u7684\u914d\u7f6e\uff0c\u4e3b\u8981\u4fdd\u5b58\u5728config.v2.json\u6587\u4ef6\u4e2d\uff0c&nbsp; &nbsp;ID\u524d\u7f00&#8230;.log \u5c31\u662f\u8fd9\u4e2a\u5bb9\u5668\u7684 \u8fd0\u884c\u65e5\u5fd7<br \/>  docker logsba5148927a1e\u5c31\u80fd\u67e5\u770b\u65e5\u5fd7<\/p>\n<p>  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>  \u8fd8\u6709\u5c31\u662f\u65b0\u624b \u5728\u76ee\u524d\u56fd\u5185\u73af\u5883\uff0cpython3\u548c\u5e93\u73af\u5883\u4e0d\u4e00\u5b9a\u80fd\u88c5\u597d<br \/>  Python3 With Network Library ( html2text scrapy beautifulsoup4 ipip-ipdb )<br \/>  \u6240\u4ee5\u8bf7\u5728\u865a\u62df\u673a\u91cc\u5b89\u88c5\u4e2a docker \uff0c\u4f7f\u7528\u6211\u5236\u4f5c\u7684 python3 \u5bb9\u5668\u955c\u50cf<\/p>\n<p>  docker run -d&#8211;restart=always -v \/app:\/app&#8211;name python3&nbsp; &nbsp;hongwenjun\/python3python3 -m http.server 8000<\/p>\n<p>  \u7136\u540e\u4f7f\u7528 \u8fd9\u6837\u547d\u4ee4 \u4ea4\u4e92\u6a21\u5f0f\u5b66\u4e60<\/p>\n<p>  docker exec -it python3python3 -i me.py<\/p>\n<p>  https:\/\/s3.bmp.ovh\/imgs\/2021\/09\/1842ccacd8ee752a.png<br \/>  \u8fd9\u4e2a\u955c\u50cf\u7684 Dockerfile \u91cc\u9762\u5df2\u7ecf\u5b89\u88c5\u5b66\u4e60\u722c\u866b\u591f\u7528\u7684\u7f51\u8def\u5e93<br \/>  # \u76f4\u63a5\u4f7f\u7528github\u4e0a\u7684Dockerfile \u6765\u7f16\u8bd1\u6784\u5efa \u955c\u50cf<br \/>  docker build -t python3https:\/\/raw.githubusercontent.com\/hongwenjun\/nginx-php\/main\/python3\/Dockerfile\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>6fyC8r<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 6fyC8r \u4e8e 2021-9-4 15:40 \u7f16\u8f91 <\/p>\n<p> \u6211\u6765\u8865\u5145\u4e00\u4e0b\u5427\uff0c<br \/>  \u5982\u4f55\u67e5\u770b\u5e76\u5e72\u51c0\u5378\u8f7d\u6240\u6709\u5bb9\u5668\u548cdocker<\/p>\n<p>  1\uff0c\u67e5\u770b\u6240\u6709\u8fd0\u884c\u7684\u5bb9\u5668\uff1a<\/p>\n<p>  docker ps -a<\/p>\n<p>  2\uff0c\u505c\u6b62\u6240\u6709\u5bb9\u5668\uff0c\u5e76\u5220\u9664\u6240\u6709\u5bb9\u5668<\/p>\n<p>  docker stop $(docker ps -q) &amp; docker rm $(docker ps -aq)<\/p>\n<p>  3\uff0c\u5220\u9664\u6240\u6709\u955c\u50cf<\/p>\n<p>  docker rmi $(docker images -q)<\/p>\n<p>  4\uff0c\u5378\u8f7ddocker<\/p>\n<p>  apt-get purge docker-ce<\/p>\n<p>  apt-get purge docker-ce-cli<\/p>\n<p>  apt-get purge containerd.io<\/p>\n<p>  5\uff0c\u68c0\u67e5\u662f\u5426\u5378\u8f7d\u5b8c\u6210<\/p>\n<p>  apt list &#8211;installed | grep docker<\/p>\n<p>  apt list &#8211;installed | grep containerd.io<\/p>\n<p>  6\uff0c\u5220\u9664\u6b8b\u4f59\u6587\u4ef6<\/p>\n<p>  rm -rf \/var\/lib\/docker<\/p>\n<p>  rm -rf \/var\/run\/docker<\/p>\n<p>  rm -rf \/etc\/docker<\/p>\n<p>  rm -rf \/run\/docker.sock<\/p>\n<p>  rm -rf \/var\/lib\/containerd<\/p>\n<p>  rm -rf \/run\/containerd<\/p>\n<p>  rm -rf \/opt\/containerd<\/p>\n<p>  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6cd5\u5916\u72c2\u5f92\u5f20\u4e09<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5173\u95ed\u3001\u5f00\u673a\u3001\u91cd\u542f\u5bb9\u5668\u7684\u5462\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>sRGB<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 sRGB \u4e8e 2021-9-4 11:55 \u7f16\u8f91 <\/p>\n<p> https:\/\/s3.bmp.ovh\/imgs\/2021\/09\/893f9a580a4600f5.png<\/p>\n<p>  Portainer\u662fDocker\u7684\u56fe\u5f62\u5316\u7ba1\u7406\u5de5\u5177\uff0c\u63d0\u4f9b\u72b6\u6001\u663e\u793a\u9762\u677f&#8230;..<\/p>\n<p>  # \u67e5\u8be2\u5f53\u524d\u6709\u54ea\u4e9bPortainer\u955c\u50cf<br \/>  docker search portaine<\/p>\n<p>  # \u5b89\u88c5Docker\u53ef\u89c6\u5316\u754c\u9762Portainer<br \/>  docker run &#8211;name Portainer&nbsp; &nbsp;portainer\/portainer&nbsp; &nbsp;&#8230;\u7701\u7565<\/p>\n<p>  # \u5220\u9664Portainer\u670d\u52a1<br \/>  docker rm-f Portainer<br \/>  docker rmi portainer\/portainer  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Tip<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8bf7\u95eedocker\u600e\u4e48\u5907\u4efd\u548c\u4f20\u6570\u636e\u5462\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>sRGB<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tTip \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-9-4 09:32<br \/>  \u8bf7\u95eedocker\u600e\u4e48\u5907\u4efd\u548c\u4f20\u6570\u636e\u5462<\/p>\n<p>  # \u8fdb\u5165 mysql \u5bb9\u5668<br \/>  docker exec -it zfaka_mysql_1 bash<\/p>\n<p>  # MySQL\u6570\u636e\u5e93\u5907\u4efd<br \/>  mysqldump-uroot -p\u5bc6\u7801(mysql) &#8211;databases faka&gt; \/tmp\/faka.sql<\/p>\n<p>  # \u9000\u51fa\u5bb9\u5668\uff0c\u8fdb\u5165\u5bbf\u4e3b\u673azfaka\u76ee\u5f55 \u6253\u5305\u7a0b\u5e8f\u548c\u6570\u636e<br \/>  cd \/opt\/zfaka<br \/>  docker cp zfaka_mysql_1:\/tmp\/faka.sql.<\/p>\n<p>  tar cvzfzfaka.tar.gz&nbsp; &nbsp;code\/faka.sqldocker-compose.yml<\/p>\n<p>  Docker mysql \u53ef\u4ee5\u4e0d\u7528\u8fdb\u5165\u5bb9\u5668\u76f4\u63a5\u5728\u5bbf\u4e3b\u673a\u5907\u4efd\u6570\u636e<br \/>  docker exec -i zfaka_mysql_1mysqldump-uroot -p\u5bc6\u7801(mysql) &#8211;databases faka&gt; \/opt\/zfaka\/zfaka_bak.sql<\/p>\n<p>  # \u53ef\u4ee5\u914d\u5408\u5b9a\u65f6\u811a\u672c\uff0c\u7528\u6765\u6bcf\u5468\u5907\u4efd\u6570\u636e\u5e93\u7b49<br \/>  TODAY=$(date +%Y)$(date +%m)$(date +%d)<br \/>  mkdir -p $(pwd)\/$TODAY &amp;&amp; cd $(pwd)\/$TODAY<br \/>  docker exec -i zfaka_mysql_1mysqldump-uroot -p\u5bc6\u7801(mysql) &#8211;databases faka&gt; faka.sql\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>lvywiki<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u770b\u4e00\u4e0b\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>ygongt74<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd8\u662fdocker\u65b9\u4fbf\uff0c\u6700\u8fd1\u5728\u5b66\u4e60\u8fd9\u65b9\u9762\u7684\u77e5\u8bc6\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>sRGB<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6cd5\u5916\u72c2\u5f92\u5f20\u4e09 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-9-4 09:23<br \/>  \u5173\u95ed\u3001\u5f00\u673a\u3001\u91cd\u542f\u5bb9\u5668\u7684\u5462<\/p>\n<p> \u5efa\u7acb\u5bb9\u5668\u7684\u65f6\u5019 \u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a \u5bb9\u5668\u540d\u79f0\uff0c\u4e0d\u6307\u5b9a \u5c31\u4f7f\u7528&nbsp; &nbsp;hash \u5b57\u7b26\u7684 \u4f5c\u4e3a ID\u53f7<\/p>\n<p>  dockerstop&nbsp; &nbsp; name(\u6216\u8005ID\uff0c\u4f7f\u7528name\u4f1a\u7b80\u5355\u70b9)<br \/>  dockerstart&nbsp; &nbsp; name<br \/>  dockerrestart&nbsp; &nbsp;name<\/p>\n<p>  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>  # \u5bbf\u4e3b\u673a\u548c\u5bb9\u5668\u4e92\u76f8\u590d\u5236\u6587\u4ef6<br \/>  docker cp name:\/root\/a.txt&nbsp; &nbsp;\/root\/a.txt<br \/>  docker cp \/root\/a.txt&nbsp; &nbsp;name:\/root\/a.txt&nbsp; &nbsp;<\/p>\n<p>  \t\t\t\t\t<strong>zjonetop<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e0d\u9519\uff0c\u5e2e\u9876\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u5728\u4e5f\u4e0d\u4e70\u5c0f\u9e21\u4e86<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tloc\u9700\u8981\u8fd9\u79cd\u5e16\u5b50\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>sRGB \u5927\u4f6c\u6709\u8bdd\u8bf4 : Dock&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/532127"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=532127"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/532127\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=532127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=532127"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=532127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}