{"id":326,"date":"2024-05-11T15:55:50","date_gmt":"2024-05-11T07:55:50","guid":{"rendered":"http:\/\/tck0521.ddns.net:6789\/?p=326"},"modified":"2024-05-21T09:31:48","modified_gmt":"2024-05-21T01:31:48","slug":"docker-%e9%95%9c%e5%83%8f%e5%88%9b%e5%bb%ba%e5%8f%8a%e5%8f%91%e5%b8%83","status":"publish","type":"post","link":"https:\/\/tck0521.dpdns.org\/?p=326","title":{"rendered":"Docker \u955c\u50cf\u521b\u5efa\u53ca\u53d1\u5e03"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Docker \u662f\u4e00\u6b3e\u5f00\u6e90\u5e73\u53f0\uff0c\u7528\u4e8e\u6784\u5efa\u3001\u90e8\u7f72\u3001\u8fd0\u884c\u548c\u7ba1\u7406\u5bb9\u5668\u5316\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u5c06\u4ee3\u7801\u548c\u6240\u6709\u4f9d\u8d56\u9879\u6253\u5305\u6210\u6807\u51c6\u5316\u5355\u5143\uff0c\u4f7f\u5176\u80fd\u591f\u8f7b\u677e\u5730\u5728\u4e0d\u540c\u73af\u5883\u4e2d\u8fd0\u884c\uff0c\u63d0\u9ad8\u4e86\u5f00\u53d1\u3001\u90e8\u7f72\u548c\u7ba1\u7406\u5e94\u7528\u7a0b\u5e8f\u7684\u6548\u7387\u3002\u7b80\u5355\u6765\u8bf4\uff0cDocker \u662f\u4e00\u4e2a\u7528\u4e8e\u6253\u5305\u548c\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u7684\u5de5\u5177\uff0c\u5b83\u4f7f\u5e94\u7528\u7a0b\u5e8f\u66f4\u6613\u4e8e\u79fb\u690d\u3001\u66f4\u53ef\u9760\u3001\u66f4\u53ef\u6269\u5c55\u4e14\u66f4\u6709\u6548\u3002<\/h2>\n\n\n\n<p>\u5728\u8fd9\u91cc\u6211\u5c31\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4f55\u7528Docker\u6784\u5efa\u4e00\u4e2aJava\u5e94\u7528\u7684\u955c\u50cf,\u4ee5\u53ca\u90e8\u7f72\u5bb9\u5668\u6765\u8fd0\u884c\u8fd9\u4e2aJava\u5e94\u7528.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0b\u8f7dDocker Desktop\u548c\u6ce8\u518cDocker\u8d26\u53f7<\/h2>\n\n\n\n<p>\u9996\u5148\u5148\u5230<a href=\"https:\/\/www.docker.com\/products\/docker-desktop\/\">https:\/\/www.docker.com\/products\/docker-desktop\/<\/a>\u4e0a,\u4e0b\u8f7dDocker Desktop\u5e76\u5b89\u88c5\u5230\u672c\u5730\u7535\u8111\u4e0a,\u6211\u7684\u662fMac\u6240\u4ee5\u9009\u62e9\u4e86Mac\u7684\u4e0b\u8f7d\u5b89\u88c5\u5305.<\/p>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6210\u540e,\u8bf7\u5230<a href=\"https:\/\/hub.docker.com\/signup\">https:\/\/hub.docker.com\/signup<\/a> \u6ce8\u518c\u4e00\u4e2a\u8d26\u53f7,\u53ef\u4ee5\u4f7f\u7528\u4f60\u5df2\u6709\u7684Github\u8d26\u53f7\u8fdb\u884c\u8054\u767b.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"594\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-16-1024x594.png\" alt=\"\" class=\"wp-image-327\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-16-1024x594.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-16-300x174.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-16-768x445.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-16-1536x890.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-16-2048x1187.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6ce8\u518c\u597d\u8d26\u53f7\u4e4b\u540e,\u6253\u5f00\u5b89\u88c5\u597d\u7684Docker Desktop,\u5e76\u70b9\u51fb\u53f3\u4e0a\u89d2\u7684Sign in\u6309\u94ae, \u8fd9\u65f6\u5019\u4f1a\u8df3\u8f6c\u5230\u6d4f\u89c8\u5668,\u6839\u636e\u63d0\u793a\u767b\u5f55\u5373\u53ef. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"594\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-17-1024x594.png\" alt=\"\" class=\"wp-image-328\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-17-1024x594.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-17-300x174.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-17-768x445.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-17-1536x890.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-17-2048x1187.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>(\u6ce8\u610f\u26a0\ufe0f:\u4ee5\u4e0a\u7684\u6b65\u9aa4,\u9700\u8981\u9b54\u6cd5\u4e0a\u7f51)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u51c6\u5907Dockerfile\u548ccompose.yaml\u6587\u4ef6<\/h2>\n\n\n\n<p>\u8981\u6253\u5305\u955c\u50cf\u548c\u521b\u5efa\u5bb9\u5668\u8fd0\u884c\u7a0b\u5e8f,\u5c31\u9700\u8981\u6709Dockerfile\u5bf9\u7a0b\u5e8f\u6240\u9700\u7684\u8fd0\u884c\u73af\u5883,\u4f9d\u8d56\u7b49\u8fdb\u884c\u6253\u5305\u5230\u4e00\u4e2a\u955c\u50cf\u91cc\u9762,\u7136\u540e\u7528compose.yaml\u6587\u4ef6\u6307\u5bfcDocker\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u5bb9\u5668\u6765\u8fd0\u884c\u8fd9\u4e2a\u7a0b\u5e8f<\/p>\n\n\n\n<p>Docker\u63d0\u4f9b\u4e86\u6bd4\u8f83\u7b80\u4fbf\u7684\u65b9\u6cd5\u521b\u5efa\u8fd9\u4e9b\u6587\u4ef6, \u6839\u636e<a href=\"https:\/\/docs.docker.com\/language\/java\/containerize\/\">https:\/\/docs.docker.com\/language\/java\/containerize\/<\/a> \u4e0a\u7684\u4ecb\u7ecd,\u53ef\u4ee5\u5728\u4f60\u7684\u7a0b\u5e8f\u6839\u76ee\u5f55\u4e0a,\u8fd0\u884c&#8221;<strong>docker init&#8221;<\/strong>\u6307\u4ee4,\u8ba9Docker\u5e2e\u4f60\u521d\u59cb\u5316\u8fd9\u4e9b\u6587\u4ef6,\u4f60\u53ea\u9700\u8981\u56de\u7b54\u51e0\u4e2a\u7b80\u5355\u7684\u95ee\u9898\u5c31\u53ef\u4ee5\u4e86<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>docker init<\/strong>\nWelcome to the Docker Init CLI!\n\nThis utility will walk you through creating the following files with sensible defaults for your project:\n  - .dockerignore\n  - Dockerfile\n  - compose.yaml\n  - README.Docker.md\n\nLet's get started!\n\nWARNING: The following Docker files already exist in this directory:\n  - docker-compose.yml\n? Do you want to overwrite them? Yes\n? What application platform does your project use? Java\n? What's the relative directory (with a leading .) for your app? .\/src\n? What version of Java do you want to use? 21\n? What port does your server listen on? 8081<\/code><\/pre>\n\n\n\n<p>\u8fd0\u884c\u7ed3\u675f\u540e,\u4f60\u5c31\u4f1a\u770b\u5230\u8fd9\u4e9b\u6587\u4ef6\u90fd\u88ab\u521b\u5efa\u597d,\u5e76\u5df2\u7ecf\u6709\u57fa\u672c\u7684\u8bbe\u7f6e\u4e86. \u4f46\u8fd9\u4e9b\u521d\u59cb\u5316\u7684\u8bbe\u7f6e\u53ef\u80fd\u662f\u4e0d\u8db3\u591f\u521b\u5efa\u955c\u50cf\u6587\u4ef6\u4ee5\u53ca\u8fd0\u884c\u5bb9\u5668\u7684,\u6240\u4ee5\u8fd8\u8981\u6839\u636e\u81ea\u8eab\u7a0b\u5e8f\u7684\u60c5\u51b5,\u8fdb\u884c\u9002\u5f53\u7684\u8c03\u6574<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"449\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-18-1024x449.png\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-18-1024x449.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-18-300x131.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-18-768x336.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-18.png 1470w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6bd4\u5982\u6211\u7684\u7a0b\u5e8f\u9700\u8981\u4e00\u4e2aconfig\u7684\u6587\u4ef6\u5939,\u4ee5\u4fbf\u5b58\u653e\u989d\u5916\u7684\u914d\u7f6e\u6587\u4ef6,\u9ed8\u8ba4\u7684Dockerfile\u662f\u4e0d\u77e5\u9053\u6709\u8fd9\u4e2a\u8bbe\u7f6e\u7684,\u6240\u4ee5\u9700\u8981\u81ea\u5df1\u5728Dockerfile\u91cc\u9762,\u5728\u9002\u5f53\u7684\u4f4d\u7f6e(&#8220;WORKDIR \/&#8221; \u8fd9\u4e00\u884c\u4e0b\u9762)\u589e\u52a0&#8221;RUN mkdir -p config&#8221;\u7684\u6307\u4ee4<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"456\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-19-1024x456.png\" alt=\"\" class=\"wp-image-330\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-19-1024x456.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-19-300x134.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-19-768x342.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-19-1536x684.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-19.png 1666w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728compose.yaml\u6587\u4ef6\u91cc\u9762,\u4e5f\u9700\u8981\u914d\u7f6e\u597d\u7a0b\u5e8f\u5728\u5bb9\u5668\u8fd0\u884c\u65f6\u5019\u7684\u6240\u6709\u7ec6\u8282<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efa\u955c\u50cf\u6587\u4ef6\u4ee5\u53ca\u6784\u5efa\u5bb9\u5668<\/h2>\n\n\n\n<p>\u5728\u8fdb\u884c\u4e4b\u524d,\u9700\u8981\u8bbe\u7f6e\u597d\u672c\u5730\u7684\u8fd0\u884c\u73af\u5883\u548c\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>JAVA_HOME=\/Library\/Java\/JavaVirtualMachines\/jdk-21.jdk\/Contents\/Home\nMAVEN_HOME=\/Dev\/apache-maven-3.9.6\nexport PATH=$PATH:\/opt\/gradle\/gradle-8.7\/bin:$JAVA_HOME\/bin:$MAVEN_HOME\/bin\n<strong>export DOCKER_DEFAULT_PLATFORM=linux\/amd64<\/strong><\/code><\/pre>\n\n\n\n<p>\u4ee5\u4e0a\u662f~\/.zshrc\u6587\u4ef6\u91cc\u9762\u7684\u90e8\u5206\u5185\u5bb9, \u9664\u4e86\u57fa\u672c\u7684\u7a0b\u5e8f\u8fd0\u884c\u6240\u9700\u7684JAVA_HOME, Maven\u4e4b\u5916,\u8fd8\u9700\u8981\u53d8\u66f4&#8221;DOCKER_DEFAULT_PLATFORM&#8221;\u7684\u503c,\u8fd9\u4e2a\u503c\u4e0d\u6539\u7684\u8bdd,\u867d\u7136\u5728\u672c\u5730\u7684Docker Desktop\u4e0a\u8fd0\u884c\u6ca1\u6709\u5f71\u54cd, \u4f46\u540e\u9762\u53d1\u5e03\u5230Docker Hub\u4e0a,\u955c\u50cf\u65e0\u6cd5\u6b63\u5e38\u5728\u5176\u4ed6\u7684Docker\u4e0a\u8fd0\u884c. \u6240\u4ee5\u4e00\u4e86\u767e\u4e86,\u76f4\u63a5\u7528\u8fd9\u4e2a\u6765\u6253\u5305\u955c\u50cf\u6bd4\u8f83\u5b89\u5168.<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u540e\u4e4b\u540e,\u4e0d\u8981\u5fd8\u8bb0\u8fd0\u884c \u4e00\u4e0b&#8221;source ~\/.zshrc&#8221;\u547d\u4ee4\u52a0\u8f7d\u914d\u7f6e,\u6216\u8005\u5f00\u4e2a\u65b0\u7684\u7a97\u53e3\u4e5f\u4f1a\u81ea\u52a8\u52a0\u8f7d<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u68c0\u67e5\u5e94\u7528\u7a0b\u5e8f\u72b6\u6001<\/h2>\n\n\n\n<p>\u6211\u4eec\u8fd8\u662f\u8981\u517b\u6210\u826f\u597d\u7684\u4e60\u60ef,\u5e94\u7528\u7a0b\u5e8f\u5982\u679c\u6709\u4efb\u4f55\u7684\u6539\u52a8\u548c\u4ee3\u7801\u53d8\u66f4,\u90fd\u8981\u9996\u5148\u81ea\u6d4b\u548c\u68c0\u67e5\u4e00\u4e0b\u662f\u5426\u8fbe\u5230\u8fd0\u884c\u7684\u6807\u51c6\u518d\u8fdb\u884cDocker\u7684\u64cd\u4f5c<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"446\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-20-1024x446.png\" alt=\"\" class=\"wp-image-331\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-20-1024x446.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-20-300x131.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-20-768x334.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-20-1536x669.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-20.png 1722w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6240\u6709\u7684\u4e1c\u897f\u51c6\u5907\u5c31\u7eea\u4e4b\u540e,\u9996\u9009\u8981\u5148\u786e\u4fdd\u4f60\u7684\u7a0b\u5e8f\u662f\u53ef\u4ee5\u8fd0\u884c\u7684,\u4e0d\u7136\u6253\u5305\u548c\u6784\u5efa\u5bb9\u5668\u4e4b\u540e\u624d\u53d1\u73b0\u4f60\u7684\u7a0b\u5e8f\u6709\u95ee\u9898,\u90a3\u5c31\u767d\u641e\u4e86,\u6211\u4e00\u822c\u5728\u505a\u6240\u6709Docker\u76f8\u5173\u7684\u64cd\u4f5c\u4e4b\u524d,\u5148\u68c0\u67e5\u4e00\u4e0b\u7a0b\u5e8f\u7684\u72b6\u6001.\u4ee5\u4e0a\u662f\u6211\u76f4\u63a5\u8fd0\u884c&#8221;mvn clean package&#8221;\u7684\u547d\u4ee4\u7684\u7ed3\u679c,\u53ef\u4ee5\u770b\u5230\u7f16\u8bd1,\u6d4b\u8bd5\u7528\u4f8b\u4ee5\u53ca\u542f\u52a8\u90fd\u6ca1\u95ee\u9898,\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u5b89\u5fc3\u7684\u5f00\u59cb\u6253\u5305\u4e86.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u521b\u5efa\u955c\u50cf\u548c\u5bb9\u5668<\/h2>\n\n\n\n<p>\u5f53\u4e00\u5207\u51c6\u5907\u5c31\u7eea\u540e,\u5c31\u53ef\u4ee5\u4f7f\u7528<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose up --build -d<\/code><\/pre>\n\n\n\n<p>\u6765\u521b\u5efa\u955c\u50cf\u548c\u5bb9\u5668\u4e86, \u8fd9\u91cc\u7684&#8221;-d&#8221;\u53c2\u6570\u7684\u610f\u601d\u662f\u521b\u5efa\u597d\u7684\u5bb9\u5668\u4f1a\u5728\u540e\u53f0\u8fd0\u884c, \u5982\u679c\u4f60\u60f3\u6301\u7eed\u89c2\u5bdf\u5bb9\u5668\u7684\u8fd0\u884c\u72b6\u6001\u548c\u65e5\u5fd7,\u53ef\u4ee5\u628a\u8fd9\u4e2a\u53c2\u6570\u53bb\u6389.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"378\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-21-1024x378.png\" alt=\"\" class=\"wp-image-333\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-21-1024x378.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-21-300x111.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-21-768x284.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-21-1536x568.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-21-2048x757.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5f53\u4f60\u8fd0\u884c\u8fd9\u4e2a\u6307\u4ee4\u4e4b\u540e,Docker\u5c31\u4f1a\u81ea\u52a8\u7684\u53bb\u4e0b\u8f7d\u76f8\u5173\u5bb9\u5668\u6240\u9700\u7684\u73af\u5883\u548c\u4f9d\u8d56,\u7b2c\u4e00\u6b21\u8fd0\u884c\u7684\u8bdd\u65f6\u95f4\u4f1a\u6bd4\u8f83\u4e45(\u6bd5\u7adf\u670927\u4e2a\u6b65\u9aa4),\u9700\u8981\u8010\u5fc3\u7b49\u5f85,\u7b49\u8fd0\u884c\u7ed3\u675f\u540e,\u53ef\u4ee5\u770b\u5230&#8221;Started&#8221;\u7684\u5b57\u773c,\u5c31\u4ee3\u8868\u955c\u50cf\u5df2\u7ecf\u6253\u5305\u597d,\u5e76\u4e14\u5bb9\u5668\u4e5f\u6b63\u5e38\u8fd0\u884c\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"639\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-22-1024x639.png\" alt=\"\" class=\"wp-image-334\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-22-1024x639.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-22-300x187.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-22-768x480.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-22-1536x959.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-22-2048x1279.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u56de\u5230Docker Desktop\u7684Images\u6807\u7b7e,\u53ef\u4ee5\u770b\u5230\u521b\u5efa\u597d\u7684\u955c\u50cf<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"639\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-23-1024x639.png\" alt=\"\" class=\"wp-image-335\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-23-1024x639.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-23-300x187.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-23-768x480.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-23-1536x959.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-23-2048x1279.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728Containers\u6807\u7b7e\u91cc\u9762,\u4e5f\u53ef\u4ee5\u770b\u5230\u6b63\u5728\u8fd0\u884c\u7684\u5bb9\u5668<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"639\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-24-1024x639.png\" alt=\"\" class=\"wp-image-336\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-24-1024x639.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-24-300x187.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-24-768x480.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-24-1536x959.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-24-2048x1279.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u70b9\u51fb\u5bb9\u5668(\u6216\u8005\u70b9\u540e\u9762\u7684&#8221;&#8230;&#8221;)\u8fdb\u5165\u5230\u5bb9\u5668\u7684\u8be6\u7ec6\u64cd\u4f5c\u9875\u9762,\u5728Logs\u8fd9\u91cc\u53ef\u4ee5\u770b\u5230\u5bb9\u5668\u8fd0\u884c\u7684\u72b6\u6001\u4ee5\u53ca\u65e5\u5fd7<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"190\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-25-1024x190.png\" alt=\"\" class=\"wp-image-337\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-25-1024x190.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-25-300x56.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-25-768x143.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-25-1536x285.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-25-2048x380.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728Console\u4e0a\u9762,\u4e5f\u53ef\u4ee5\u7528&#8221;docker ps&#8221;\u67e5\u770b\u5230\u8fd0\u884c\u7684\u5bb9\u5668,\u7528&#8221;docker images&#8221;\u53ef\u4ee5\u770b\u5230\u521b\u5efa\u7684\u955c\u50cf<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0a\u4f20\u955c\u50cf\u5230Docker Hub<\/h2>\n\n\n\n<p>\u5230\u8fd9\u91cc,\u955c\u50cf\u6587\u4ef6\u4ee5\u53ca\u5bb9\u5668\u90fd\u6b63\u5e38\u88ab\u521b\u5efa\u548c\u8fd0\u884c,\u53ef\u4ee5\u53d1\u5e03\u5230Docker Hub\u8ba9\u5176\u4ed6\u4eba\u4e5f\u4f7f\u7528\u4e86.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"670\" height=\"100\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-26.png\" alt=\"\" class=\"wp-image-338\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-26.png 670w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-26-300x45.png 300w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><\/figure>\n\n\n\n<p>\u5148\u7528&#8221;docker login&#8221;\u786e\u4fdd\u4f60\u7684\u767b\u5f55\u72b6\u6001\u6ca1\u6709\u95ee\u9898<\/p>\n\n\n\n<p>\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u5bf9\u521a\u521a\u521b\u5efa\u597d\u7684\u955c\u50cf\u6253\u4e2atag<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker tag &lt;Image name> &lt;Docker login>\/&lt;Published imagename>:&lt;tag name><\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f: &lt;Docker login> \u5fc5\u987b\u662f\u4f60\u5728Docker\u6ce8\u518c\u65f6\u5019\u7684\u540d\u5b57,\u4e0d\u8bb0\u5f97\u7684\u53ef\u4ee5\u56de\u53bb<a href=\"https:\/\/hub.docker.com\/\">https:\/\/hub.docker.com\/<\/a> \u767b\u5f55\u540e\u8fdb\u5165Repositories\u770b\u770b<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"259\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-27-1024x259.png\" alt=\"\" class=\"wp-image-339\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-27-1024x259.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-27-300x76.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-27-768x194.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-27-1536x388.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-27-2048x517.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u6bd4\u5982\u6211\u521a\u521a\u6253\u5305\u521b\u5efa\u51fa\u6765\u7684\u955c\u50cf\u540d\u5b57\u901a\u8fc7&#8221;docker images&#8221;\u770b\u5230\u662f\u53ebgenerativeai-server, \u7136\u540e\u6211Docker\u7684\u7528\u6237\u540d\u662fmyDockerUserName, \u90a3\u6211\u5c31\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u7ed9\u8fd9\u4e2a\u955c\u50cf\u6253\u4e2atag<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker tag generativeai-server myDockerUserName\/generativeai:v1.0<\/code><\/pre>\n\n\n\n<p>\u5efa\u8bae\u53ef\u4ee5\u7528\u540c\u6837\u7684\u955c\u50cf\u518d\u521b\u5efa\u4e00\u4e2alatest\u7684tag, \u56e0\u4e3a\u4e00\u822c\u6211\u4eec&#8221;docker pull &lt;\u955c\u50cf&gt;&#8221;\u65f6,\u5982\u679c\u4e0d\u6307\u5b9atag\u5c31\u9ed8\u8ba4\u4f7f\u7528latest<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"263\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-28-1024x263.png\" alt=\"\" class=\"wp-image-340\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-28-1024x263.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-28-300x77.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-28-768x197.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-28.png 1068w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u6837\u6211\u4eec\u518d\u7528&#8221;docker images&#8221;\u5c31\u53ef\u4ee5\u770b\u5230latest\u548cv1.0\u7684tag\u90fd\u6253\u597d\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"350\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-52-1024x350.png\" alt=\"\" class=\"wp-image-392\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-52-1024x350.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-52-300x103.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-52-768x262.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-52.png 1434w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u65f6\u5019\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u53d1\u5e03\u521a\u521a\u521b\u5efa\u597d\u7684\u955c\u50cf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker push myDockerUserName\/generativeai:v1.0<\/code><\/pre>\n\n\n\n<p>\u6216\u8005\u7528Docker Desktop\u6765\u64cd\u4f5c\u4e5f\u53ef\u4ee5<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"403\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-29-1024x403.png\" alt=\"\" class=\"wp-image-341\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-29-1024x403.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-29-300x118.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-29-768x303.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-29-1536x605.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-29-2048x807.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u56de\u5230Docker Desktop\u7684Images\u6807\u7b7e,\u5c31\u53ef\u4ee5\u770b\u5230\u8fd9\u4e24\u4e2a\u6253\u597dtag\u7684\u955c\u50cf\u4e86,\u8fd9\u65f6\u5019\u53ef\u4ee5\u70b9\u51fb\u8fd9\u4e2a\u955c\u50cf\u53f3\u8fb9\u7684&#8221;&#8230;&#8221;\u7136\u540e\u9009\u62e9&#8221;Push to Hub&#8221;\u5c31\u53ef\u4ee5\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"696\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-30-1024x696.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-30-1024x696.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-30-300x204.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-30-768x522.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-30-1536x1044.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-30-2048x1392.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4e0a\u4f20\u7ed3\u675f\u540e,\u6765\u5230<a href=\"https:\/\/hub.docker.com\/\">https:\/\/hub.docker.com\/<\/a>\u7684Repostories\u4e0b\u9762,\u5c31\u53ef\u4ee5\u770b\u5230\u4f60\u53d1\u5e03\u7684\u955c\u50cf\u4e86!!!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"571\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-34-1024x571.png\" alt=\"\" class=\"wp-image-352\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-34-1024x571.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-34-300x167.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-34-768x428.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-34-1536x856.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-34-2048x1141.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u53d1\u5e03\u5230Docker Hub\u4e4b\u540e,\u4f60\u7684\u955c\u50cf\u5c31\u53ef\u4ee5\u5728\u4e0a\u9762\u88ab\u5176\u4ed6\u4eba\u641c\u7d22\u5e76\u4e0b\u8f7d\u4f7f\u7528,\u5f53\u7136\u5177\u4f53\u7684compose.yaml\u6587\u4ef6\u5185\u5bb9,\u9700\u8981\u4f60\u63d0\u4f9b\u4e00\u4e0b,\u8ba9\u5c0f\u4f19\u4f34\u4eec\u77e5\u9053\u5982\u4f55\u8fd0\u884c\u5bb9\u5668<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">NAS Container Manager<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-36-1024x547.png\" alt=\"\" class=\"wp-image-357\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-36-1024x547.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-36-300x160.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-36-768x410.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-36-1536x820.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-36-2048x1093.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5728NAS\u7684Container Manager\u91cc\u9762,\u70b9\u51fb\u6ce8\u518c\u8868\u6807\u7b7e,\u70b9\u51fb\u8bbe\u7f6e,\u65b0\u589e\u4e00\u4e2aDocker\u6765\u6e90, \u6ce8\u518c\u8868URL\u4e3a: https:\/\/index.docker.io <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"541\" src=\"http:\/\/tck0521.ddns.net:6789\/wp-content\/uploads\/2024\/05\/image-35-1024x541.png\" alt=\"\" class=\"wp-image-355\" srcset=\"https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-35-1024x541.png 1024w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-35-300x159.png 300w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-35-768x406.png 768w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-35-1536x812.png 1536w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-35-2048x1082.png 2048w, https:\/\/tck0521.dpdns.org\/wp-content\/uploads\/2024\/05\/image-35-720x380.png 720w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u7136\u540e\u5c31\u53ef\u4ee5\u5728NAS\u7684Container Manager\u6ce8\u518c\u8868\u91cc\u9762\u641c\u7d22\u521a\u521a\u53d1\u5e03\u7684\u955c\u50cf,\u4e5f\u5c31\u662f\u8bf4\u8fd9\u4e2a\u955c\u50cf\u53ef\u4ee5\u5728NAS\u7684Contianer Manager\u4e0b\u8f7d\u548c\u6784\u5efa\u5bb9\u5668\u8fd0\u884c\u54e6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker \u662f\u4e00\u6b3e\u5f00\u6e90\u5e73\u53f0\uff0c&hellip;<\/p>\n","protected":false},"author":2,"featured_media":344,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[4],"class_list":["post-326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-2","tag-docker"],"_links":{"self":[{"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=326"}],"version-history":[{"count":13,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":393,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/326\/revisions\/393"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=\/wp\/v2\/media\/344"}],"wp:attachment":[{"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tck0521.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}