{"id":540,"date":"2022-04-23T12:44:05","date_gmt":"2022-04-23T04:44:05","guid":{"rendered":"https:\/\/830519.xyz\/?p=540"},"modified":"2023-05-10T08:19:57","modified_gmt":"2023-05-10T00:19:57","slug":"docker","status":"publish","type":"post","link":"https:\/\/830519.xyz\/?p=540","title":{"rendered":"Docker"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code><strong>\u5b98\u7f51<\/strong>\n<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.docker.com\/\" data-type=\"URL\" data-id=\"https:\/\/docs.docker.com\/\" target=\"_blank\">https:\/\/docs.docker.com\/<\/a>\n<a rel=\"noreferrer noopener\" href=\"https:\/\/hub.docker.com\/\" data-type=\"URL\" data-id=\"https:\/\/hub.docker.com\/\" target=\"_blank\">https:\/\/hub.docker.com\/<\/a>\n<a href=\"https:\/\/docs.docker.com\/engine\/install\/debian\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.docker.com\/engine\/install\/debian\/<\/a><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#Docker\u5b89\u88c5<\/strong>\n<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/docker\/docker-install\" target=\"_blank\">https:\/\/github.com\/docker\/docker-install<\/a>\ncurl -sSL https:\/\/get.docker.com | bash\nwget -qO- get.docker.com | bash\ncurl -sSL https:\/\/get.docker.com\/ | sh\n\nsystemctl start docker\nsystemctl status docker\nsystemctl enable docker\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u5b89\u88c5 docker Compose 1.x\u7248\u672c<\/strong>\n<a rel=\"noreferrer noopener\" href=\"https:\/\/docs.docker.com\/compose\/cli-command\/#install-on-linux\" data-type=\"URL\" data-id=\"https:\/\/docs.docker.com\/compose\/cli-command\/#install-on-linux\" target=\"_blank\">https:\/\/docs.docker.com\/compose\/cli-command\/#install-on-linux<\/a>\n\ncurl -L \"https:\/\/github.com\/docker\/compose\/releases\/download\/1.26.0\/docker-compose-$(uname -s)-$(uname -m)\" -o \/usr\/local\/bin\/docker-compose\nchmod +x \/usr\/local\/bin\/docker-compose\n\u521b\u5efa\u8fde\u63a5\u653e\u5165\/usr\/bin,\u56e0\u4e3a\/usr\/bin\u5728PATH\u76ee\u5f55\u4e0b\u53ef\u4ee5\u4e0d\u7528\u7edd\u5bf9\u8def\u5f84\u76f4\u63a5\u8bbf\u95ee\u3002\nln -s \/usr\/local\/bin\/docker-compose \/usr\/bin\/docker-compose\ndocker-compose --version\n\u5378\u8f7d\nrm \/usr\/local\/bin\/docker-compose\n\n<strong>\u5b89\u88c5 docker compose v2\u7248\u672c<\/strong>\nmkdir -p ~\/.docker\/cli-plugins\ncurl -SL https:\/\/github.com\/docker\/compose\/releases\/download\/v2.2.3\/docker-compose-linux-x86_64 -o ~\/.docker\/cli-plugins\/docker-compose\n\u8981\u4e3a\u7cfb\u7edf\u4e0a\u7684\u6240\u6709\u7528\u6237\u5b89\u88c5 Docker Compose\uff0c\u8bf7\u66ff\u6362~\/.docker\/cli-plugins\u4e3a\/usr\/local\/lib\/docker\/cli-plugins.\nchmod +x ~\/.docker\/cli-plugins\/docker-compose\ndocker compose version<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#\u5e38\u7528\u547d\u4ee4<\/strong>\ndocker info\nsystemctl start docker\nsystemctl stop docker\nsystemctl restart docker\nsystemctl status docker\nsystemctl enable docker\n\ndocker ps -aq\ndocker stop $(docker ps -aq)\ndocker rm $(docker ps -aq)\ndocker rmi $(docker images -q)\n\ndocker system prune -a\n\ndocker exec -it 049d98ba2265 bash\n\n#\u6587\u4ef6\u590d\u5236\ndocker cp 049d98ba2265:\/var\/www\/html\/index.php \/root\ndocker cp \/root\/index.php 049d98ba2265:\/var\/www\/html\n\ndocker commit\uff1a\u5c06\u5bb9\u5668\u4fdd\u5b58\u4e3a\u955c\u50cf                   docker commit \u5bb9\u5668\u540d\u79f0 \u65b0\u7684\u955c\u50cf\u540d\u79f0\ndocker save -o\uff1a\u5c06\u955c\u50cf\u5907\u4efd\u4e3atar\u6587\u4ef6               docker save -o tar\u6587\u4ef6\u540d \u955c\u50cf\u540d\ndocker load -i\uff1a\u6839\u636etar\u6587\u4ef6\u6062\u590d\u4e3a\u955c\u50cf             docker load -i tar\u6587\u4ef6\u540d<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>docker\u652f\u6301IPV6<\/strong>\nnano \/etc\/docker\/daemon.json\n\n{\n  \"ipv6\": true,\n  \"fixed-cidr-v6\": \"fd00:db8:abc1::\/64\",\n  \"experimental\": true,\n  \"ip6tables\": true\n}\n\n\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u91cd\u542fdocker\uff0c\u7136\u540e\u542f\u52a8\u4e00\u4e2abusybox\u7684\u6d4b\u8bd5\u5bb9\u5668\u6765ping -6\u6d4b\u8bd5ipv6\u7684\u7f51\u7edc\u662f\u5426\u901a\u4e86\ndocker run -it --name=test busybox\n#ping -6 www.google.com\n\ndocker network ls\ndocker network inspect bridge\ndocker exec c4ba39c6a264 ping6 google.com<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>#Alist<\/strong> - <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/Xhofe\/alist\" data-type=\"URL\" data-id=\"https:\/\/github.com\/Xhofe\/alist\" target=\"_blank\">https:\/\/github.com\/Xhofe\/alist<\/a> - <a rel=\"noreferrer noopener\" href=\"https:\/\/alist-doc.nn.ci\/\" data-type=\"URL\" data-id=\"https:\/\/alist-doc.nn.ci\/\" target=\"_blank\">https:\/\/alist-doc.nn.ci\/<\/a>\ndocker pull xhofe\/alist\ndocker run -d --restart=always -v \/etc\/alist:\/opt\/alist\/data -p 5244:5244 --name=\"alist\" xhofe\/alist:latest\n\n#Initial password\uff1a\ndocker logs alist\n# or\ndocker exec -it alist .\/alist -password\n\n#\u914d\u7f6e\u53cd\u5411\u4ee3\u7406\n\u6ce8\u91ca\uff1a\n    location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf)$\n    {\n        expires      30d;\n        error_log \/dev\/null;\n        access_log off;\n    }\n\n    location ~ .*\\.(js|css)?$\n    {\n        expires      12h;\n        error_log \/dev\/null;\n        access_log off; \n    }\n\u6dfb\u52a0\uff1a\nlocation \/ {\n    proxy_pass http:\/\/127.0.0.1:5244\/;\n    rewrite ^\/(.*)$ \/$1 break;\n    proxy_redirect off;\n    proxy_set_header Host $host;\n    proxy_set_header X-Forwarded-Proto $scheme;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header Upgrade-Insecure-Requests 1;\n    proxy_set_header X-Forwarded-Proto https;\n}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-540","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/830519.xyz\/index.php?rest_route=\/wp\/v2\/posts\/540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/830519.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/830519.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/830519.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/830519.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=540"}],"version-history":[{"count":12,"href":"https:\/\/830519.xyz\/index.php?rest_route=\/wp\/v2\/posts\/540\/revisions"}],"predecessor-version":[{"id":760,"href":"https:\/\/830519.xyz\/index.php?rest_route=\/wp\/v2\/posts\/540\/revisions\/760"}],"wp:attachment":[{"href":"https:\/\/830519.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/830519.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/830519.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}