{"id":1302,"date":"2026-01-10T10:28:45","date_gmt":"2026-01-10T02:28:45","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=1302"},"modified":"2026-01-10T10:28:45","modified_gmt":"2026-01-10T02:28:45","slug":"%e4%bd%bf%e7%94%a8docker%e9%83%a8%e7%bd%b2pwgen%e7%ae%80%e5%8d%95%e5%af%86%e7%a0%81%e7%94%9f%e6%88%90%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2026\/01\/10\/%e4%bd%bf%e7%94%a8docker%e9%83%a8%e7%bd%b2pwgen%e7%ae%80%e5%8d%95%e5%af%86%e7%a0%81%e7%94%9f%e6%88%90%e5%99%a8\/","title":{"rendered":"\u4f7f\u7528Docker\u90e8\u7f72pwgen\u7b80\u5355\u5bc6\u7801\u751f\u6210\u5668"},"content":{"rendered":"\n<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u4e2a<strong>\u7b80\u5355\u3001\u5b9e\u7528\u3001\u53ef\u76f4\u63a5\u590d\u5236\u6267\u884c<\/strong>\u7684\u65b9\u6848<br>\ud83d\udc49 <strong>\u4f7f\u7528 Docker \u90e8\u7f72 pwgen\uff08\u7b80\u5355\u5bc6\u7801\u751f\u6210\u5668\uff09<\/strong><br>\u8986\u76d6 <strong>\u547d\u4ee4\u884c\u7528\u6cd5 \/ \u5c01\u88c5\u6210\u670d\u52a1 \/ Web \u5f62\u5f0f\uff08\u53ef\u9009\uff09<\/strong> \u4e09\u79cd\u573a\u666f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e00\u3001pwgen \u662f\u4ec0\u4e48\uff1f<\/h1>\n\n\n\n<p><strong>pwgen<\/strong> \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u5bc6\u7801\u751f\u6210\u5de5\u5177\uff0c\u7528\u4e8e\u751f\u6210\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u968f\u673a\u5bc6\u7801<\/li>\n\n\n\n<li>\u6307\u5b9a\u957f\u5ea6<\/li>\n\n\n\n<li>\u662f\u5426\u5305\u542b\u6570\u5b57 \/ \u7279\u6b8a\u5b57\u7b26<\/li>\n\n\n\n<li>\u591a\u4e2a\u5bc6\u7801\u4e00\u6b21\u751f\u6210<\/li>\n<\/ul>\n\n\n\n<p>\ud83d\udccc \u5e38\u89c1\u7528\u9014\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fd0\u7ef4\u751f\u6210\u521d\u59cb\u5bc6\u7801<\/li>\n\n\n\n<li>\u811a\u672c\u81ea\u52a8\u5316<\/li>\n\n\n\n<li>\u4e34\u65f6\u8d26\u53f7\u5bc6\u7801<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e8c\u3001\u65b9\u5f0f\u4e00\uff1a\u76f4\u63a5\u7528 Docker \u8fd0\u884c pwgen\uff08\u6700\u63a8\u8350 \u2b50\u2b50\u2b50\u2b50\u2b50\uff09<\/h1>\n\n\n\n<p>\u8fd9\u662f<strong>\u6700\u7b80\u5355\u3001\u6700\u7eaf\u7cb9<\/strong>\u7684\u7528\u6cd5\uff0c\u4e0d\u9700\u8981\u5199 Dockerfile\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1\ufe0f\u20e3 \u76f4\u63a5\u8fd0\u884c pwgen<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm alpine sh -c &quot;apk add --no-cache pwgen &amp;amp;&amp;amp; pwgen 16 5&quot;\n\n<\/pre><\/div>\n\n\n<p>\u89e3\u91ca\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u53c2\u6570<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><code>--rm<\/code><\/td><td>\u7528\u5b8c\u5373\u5220\u5bb9\u5668<\/td><\/tr><tr><td><code>alpine<\/code><\/td><td>\u8d85\u5c0f\u955c\u50cf<\/td><\/tr><tr><td><code>pwgen 16 5<\/code><\/td><td>\u751f\u6210 5 \u4e2a 16 \u4f4d\u5bc6\u7801<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2\ufe0f\u20e3 \u5e38\u7528 pwgen \u53c2\u6570\u793a\u4f8b<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# \u751f\u6210 1 \u4e2a 20 \u4f4d\u5bc6\u7801\npwgen 20 1\n\n# \u5305\u542b\u6570\u5b57\npwgen -n 16 1\n\n# \u5305\u542b\u7279\u6b8a\u5b57\u7b26\npwgen -s 16 1\n\n# \u5f3a\u5bc6\u7801\uff08\u63a8\u8350\uff09\npwgen -sy 16 3\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3\ufe0f\u20e3 \u5b9e\u9645 Docker \u793a\u4f8b<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm alpine sh -c \\\n&quot;apk add --no-cache pwgen &amp;amp;&amp;amp; pwgen -sy 16 3&quot;\n\n<\/pre><\/div>\n\n\n<p>\u8f93\u51fa\u793a\u4f8b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nH9$3m!2QzR@e8P#A\nQw7@!9Zx4%R8KpM2\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e09\u3001\u65b9\u5f0f\u4e8c\uff1a\u81ea\u5b9a\u4e49 pwgen Docker \u955c\u50cf\uff08\u65b9\u4fbf\u957f\u671f\u4f7f\u7528\uff09<\/h1>\n\n\n\n<p>\u9002\u5408\uff1a<strong>\u670d\u52a1\u5668\u7ecf\u5e38\u7528 pwgen<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1\ufe0f\u20e3 \u521b\u5efa Dockerfile<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir pwgen-docker\ncd pwgen-docker\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\"><code>Dockerfile<\/code><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nFROM alpine:latest\n\nRUN apk add --no-cache pwgen\n\nENTRYPOINT &#x5B;&quot;pwgen&quot;]\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2\ufe0f\u20e3 \u6784\u5efa\u955c\u50cf<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker build -t pwgen .\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3\ufe0f\u20e3 \u4f7f\u7528\u81ea\u5b9a\u4e49\u955c\u50cf<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm pwgen -sy 16 5\n\n<\/pre><\/div>\n\n\n<p>\ud83d\udccc \u50cf\u672c\u5730\u547d\u4ee4\u4e00\u6837\u7528 Docker<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u56db\u3001\u65b9\u5f0f\u4e09\uff1apwgen + Shell \u811a\u672c\uff08\u66f4\u53cb\u597d\uff09<\/h1>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1\ufe0f\u20e3 \u521b\u5efa\u811a\u672c<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>gen.sh<\/code><\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#!\/bin\/sh\npwgen -sy 16 1\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2\ufe0f\u20e3 Dockerfile\uff08\u811a\u672c\u7248\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nFROM alpine\nRUN apk add --no-cache pwgen\nCOPY gen.sh \/gen.sh\nRUN chmod +x \/gen.sh\nENTRYPOINT &#x5B;&quot;\/gen.sh&quot;]\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3\ufe0f\u20e3 \u4f7f\u7528<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm pwgen\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e94\u3001\u65b9\u5f0f\u56db\uff1apwgen \u5c01\u88c5\u6210 Web \u5bc6\u7801\u751f\u6210\u5668\uff08\u53ef\u9009\u8fdb\u9636\uff09<\/h1>\n\n\n\n<p>\u26a0\ufe0f \u5982\u679c\u4f60\u53ea\u662f\u60f3\u751f\u6210\u5bc6\u7801\uff0c<strong>\u4e0d\u63a8\u8350\u4e0a Web<\/strong><br>\u4f46\u5b66\u4e60 Docker + \u670d\u52a1\u5f88\u5408\u9002\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u793a\u4f8b\uff1apwgen + HTTP API\uff08\u6781\u7b80\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run -d \\\n  --name pwgen-web \\\n  -p 8080:8080 \\\n  alpine sh -c \\\n  &quot;apk add --no-cache pwgen busybox-extras &amp;amp;&amp;amp; \\\n   httpd -f -p 8080 -h \/www&quot;\n\n<\/pre><\/div>\n\n\n<p>\uff08\u751f\u4ea7\u5efa\u8bae\u7528\u73b0\u6210 Web \u5bc6\u7801\u5de5\u5177\uff09<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u516d\u3001\u4e3a\u4ec0\u4e48\u7528 Docker \u8dd1 pwgen\uff1f<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u4f18\u70b9<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td>\u65e0\u9700\u5b89\u88c5<\/td><td>\u5bbf\u4e3b\u673a\u96f6\u6c61\u67d3<\/td><\/tr><tr><td>\u8de8\u5e73\u53f0<\/td><td>Linux \/ Mac \/ Windows<\/td><\/tr><tr><td>\u7528\u5b8c\u5373\u8d70<\/td><td>\u5b89\u5168<\/td><\/tr><tr><td>\u53ef\u811a\u672c\u5316<\/td><td>CI\/CD<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e03\u3001\u5e38\u89c1\u95ee\u9898<\/h1>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u274c \u5bb9\u5668\u4e00\u8fd0\u884c\u5c31\u9000\u51fa\uff1f<\/h2>\n\n\n\n<p>\u2705 \u6b63\u5e38<br>pwgen \u662f\u4e00\u6b21\u6027\u547d\u4ee4\u5de5\u5177<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u274c \u5982\u4f55\u590d\u5236\u751f\u6210\u7684\u5bc6\u7801\uff1f<\/h2>\n\n\n\n<p>\u76f4\u63a5\u590d\u5236\u7ec8\u7aef\u8f93\u51fa\u5373\u53ef<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u274c \u80fd\u5199\u6210\u522b\u540d\u5417\uff1f<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nalias pwgen-docker=&#039;docker run --rm pwgen&#039;\n\n<\/pre><\/div>\n\n\n<p>\u4e4b\u540e\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npwgen-docker -sy 20 1\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u516b\u3001\u63a8\u8350\u4f7f\u7528\u65b9\u5f0f\uff08\u603b\u7ed3\uff09<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u573a\u666f<\/th><th>\u63a8\u8350\u65b9\u5f0f<\/th><\/tr><\/thead><tbody><tr><td>\u5076\u5c14\u7528<\/td><td><code>docker run alpine pwgen<\/code><\/td><\/tr><tr><td>\u7ecf\u5e38\u7528<\/td><td>\u81ea\u5b9a\u4e49\u955c\u50cf<\/td><\/tr><tr><td>\u81ea\u52a8\u5316<\/td><td>CI \/ \u811a\u672c<\/td><\/tr><tr><td>\u5b66\u4e60 Docker<\/td><td>\u81ea\u5efa Dockerfile<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e5d\u3001\u4e00\u53e5\u8bdd\u603b\u7ed3\uff08\u5fc5\u8bb0\uff09<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>pwgen \u662f\u4e00\u6b21\u6027\u547d\u4ee4\u5de5\u5177\uff0c<br>\u7528 Docker \u8fd0\u884c\u6700\u5e72\u51c0\u3001\u6700\u5b89\u5168\uff0c<br>Alpine + pwgen \u662f\u6700\u4f73\u7ec4\u5408\u3002<\/strong><\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u597d\uff0c<strong>1\ufe0f\u20e32\ufe0f\u20e33\ufe0f\u20e34\ufe0f\u20e3 \u6211\u4e00\u6b21\u6027\u5168\u90e8\u7ed9\u4f60<\/strong>\uff0c\u505a\u6210\u4e00\u4efd<strong>\u8fd0\u7ef4\/\u9762\u8bd5\/\u5b9e\u6218\u90fd\u80fd\u76f4\u63a5\u7528\u7684 pwgen \u5b8c\u6574\u901f\u67e5\u4e0e\u5bf9\u6bd4\u5408\u96c6<\/strong> \ud83d\udc47<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e00\u3001pwgen \u53c2\u6570\u901f\u67e5\u8868\uff081\ufe0f\u20e3\uff09<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u6700\u5e38\u7528\u53c2\u6570\uff08\u5fc5\u80cc\uff09<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u53c2\u6570<\/th><th>\u4f5c\u7528<\/th><th>\u793a\u4f8b<\/th><\/tr><\/thead><tbody><tr><td><code>-n<\/code><\/td><td>\u5305\u542b\u6570\u5b57<\/td><td><code>pwgen -n 16 1<\/code><\/td><\/tr><tr><td><code>-s<\/code><\/td><td>\u5b8c\u5168\u968f\u673a\uff08\u5f3a\u5bc6\u7801\uff09<\/td><td><code>pwgen -s 16 1<\/code><\/td><\/tr><tr><td><code>-y<\/code><\/td><td>\u5305\u542b\u7279\u6b8a\u5b57\u7b26<\/td><td><code>pwgen -sy 16 1<\/code><\/td><\/tr><tr><td><code>-c<\/code><\/td><td>\u81f3\u5c11\u4e00\u4e2a\u5927\u5199\u5b57\u6bcd<\/td><td><code>pwgen -c 16 1<\/code><\/td><\/tr><tr><td><code>-v<\/code><\/td><td>\u6392\u9664\u6613\u6df7\u6dc6\u5b57\u7b26<\/td><td><code>pwgen -v 16 1<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u2b50 \u63a8\u8350\u5b89\u5168\u7ec4\u5408\uff08\u751f\u4ea7\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npwgen -syc 20 3\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e8c\u3001pwgen + CI \/ \u81ea\u52a8\u5316\uff082\ufe0f\u20e3\uff09<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u793a\u4f8b\uff1aCI \u4e2d\u81ea\u52a8\u751f\u6210\u6570\u636e\u5e93\u5bc6\u7801<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDB_PASS=$(docker run --rm pwgen -sy 20 1)\necho &quot;DB_PASS=$DB_PASS&quot;\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">GitHub Actions \u793a\u4f8b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n- name: Generate Password\n  run: |\n    PASS=$(docker run --rm pwgen -sy 20 1)\n    echo &quot;DB_PASS=$PASS&quot; &gt;&gt; $GITHUB_ENV\n\n<\/pre><\/div>\n\n\n<p>\ud83d\udccc \u4f18\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e0d\u843d\u76d8<\/li>\n\n\n\n<li>\u53ef\u590d\u73b0<\/li>\n\n\n\n<li>\u5bb9\u5668\u5373\u5de5\u5177<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e09\u3001pwgen vs openssl rand\uff083\ufe0f\u20e3 \u9762\u8bd5\u5fc5\u95ee\uff09<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">1\ufe0f\u20e3 pwgen<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npwgen -sy 16 1\n\n<\/pre><\/div>\n\n\n<p>\u2714 \u6613\u7528<br>\u2714 \u53ef\u8bfb\u6027\u597d<br>\u274c \u968f\u673a\u6027\u7565\u4f4e\u4e8e openssl<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2\ufe0f\u20e3 openssl rand<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nopenssl rand -base64 16\n\n<\/pre><\/div>\n\n\n<p>\u2714 \u52a0\u5bc6\u7ea7\u968f\u673a<br>\u2714 \u5b89\u5168\u6027\u6700\u9ad8<br>\u274c \u4e0d\u6613\u8bfb<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u5bf9\u6bd4\u603b\u7ed3\u8868<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u9879\u76ee<\/th><th>pwgen<\/th><th>openssl rand<\/th><\/tr><\/thead><tbody><tr><td>\u6613\u7528\u6027<\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50<\/td><\/tr><tr><td>\u5b89\u5168\u6027<\/td><td>\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2b50\u2b50\u2b50\u2b50\u2b50<\/td><\/tr><tr><td>\u53ef\u8bfb\u6027<\/td><td>\u2b50\u2b50\u2b50\u2b50<\/td><td>\u2b50<\/td><\/tr><tr><td>\u8fd0\u7ef4\u5e38\u7528<\/td><td>\u2705<\/td><td>\u2705<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\ud83d\udccc <strong>\u7ed3\u8bba\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7528\u6237\u5bc6\u7801 \u2192 <code>pwgen<\/code><\/li>\n\n\n\n<li>\u5bc6\u94a5 \/ Token \u2192 <code>openssl rand<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u56db\u3001Docker \u8fd0\u7ef4\u5c0f\u5de5\u5177\u5408\u96c6\uff084\ufe0f\u20e3 \u5f3a\u70c8\u63a8\u8350\uff09<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">1\ufe0f\u20e3 pwgen\uff08\u5bc6\u7801\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm pwgen -sy 20 1\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2\ufe0f\u20e3 htpasswd\uff08HTTP \u8ba4\u8bc1\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm httpd htpasswd -nb user pass\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3\ufe0f\u20e3 jq\uff08JSON \u5904\u7406\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm -i imega\/jq jq &#039;.name&#039;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4\ufe0f\u20e3 curl + httpie\uff08API \u8c03\u8bd5\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker run --rm curlimages\/curl curl https:\/\/example.com\n\n<\/pre><\/div>\n\n\n<p>\ud83d\udccc <strong>\u7406\u5ff5\uff1a<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Docker = \u5de5\u5177\u7bb1<br>\u7528\u5b8c\u5373\u5220\uff0c\u4e0d\u6c61\u67d3\u7cfb\u7edf<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e94\u3001\u63a8\u8350\u4f60\u7684\u6700\u7ec8\u4f7f\u7528\u59ff\u52bf\uff08\u5b9e\u6218\uff09<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">\u2460 \u6784\u5efa pwgen \u4e13\u7528\u955c\u50cf<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker build -t pwgen .\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">\u2461 \u8bbe\u7f6e shell \u522b\u540d<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nalias pwgen=&#039;docker run --rm pwgen&#039;\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">\u2462 \u50cf\u672c\u5730\u547d\u4ee4\u4e00\u6837\u7528<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npwgen -sy 24 1\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u516d\u3001\u4e00\u53e5\u8bdd\u7ec8\u6781\u603b\u7ed3\uff08\u80cc\u4e0b\u6765\uff09<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>pwgen \u9002\u5408\u751f\u6210\u7528\u6237\u5bc6\u7801\uff0c<br>Docker \u8ba9\u5b83\u53d8\u6210\u96f6\u5b89\u88c5\u5de5\u5177\uff0c<br>CI \u81ea\u52a8\u5316\u7528 pwgen\uff0c<br>\u9ad8\u5b89\u5168\u5bc6\u94a5\u7528 openssl rand\u3002<\/strong><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u4e2a\u7b80\u5355\u3001\u5b9e\u7528\u3001\u53ef\u76f4\u63a5\u590d\u5236\u6267\u884c\u7684\u65b9\u6848\ud83d\udc49 \u4f7f\u7528 Docker \u90e8\u7f72 pwg&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2026\/01\/10\/%e4%bd%bf%e7%94%a8docker%e9%83%a8%e7%bd%b2pwgen%e7%ae%80%e5%8d%95%e5%af%86%e7%a0%81%e7%94%9f%e6%88%90%e5%99%a8\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1302","post","type-post","status-publish","format-standard","hentry","category-55"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/1302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=1302"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/1302\/revisions"}],"predecessor-version":[{"id":1303,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/1302\/revisions\/1303"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=1302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=1302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=1302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}