{"id":1117,"date":"2024-04-11T13:50:45","date_gmt":"2024-04-11T04:50:45","guid":{"rendered":"https:\/\/shinke1987.net\/?p=1117"},"modified":"2024-04-11T13:50:46","modified_gmt":"2024-04-11T04:50:46","slug":"ab%e5%ae%9f%e8%a1%8c%e7%94%a8%e3%81%aedocker%e3%82%b3%e3%83%b3%e3%83%86%e3%83%8a%e4%bd%9c%e6%88%90%e3%81%a8%e5%ae%9f%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=1117","title":{"rendered":"ab\u5b9f\u884c\u7528\u306eDocker\u30b3\u30f3\u30c6\u30ca\u4f5c\u6210\u3068\u5b9f\u884c"},"content":{"rendered":"\n<h2 id=\"toc0\" class=\"wp-block-heading\">\u76ee\u7684<\/h2>\n\n\n\n<p>\u74b0\u5883\u3092\u6c5a\u3057\u305f\u304f\u306a\u3044\u306e\u3067\u3001ab\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u3060\u3051\u306bDocker\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n\n\n\n<p>ab = Apache HTTP server Benchmarking tool<\/p>\n\n\n\n<h2 id=\"toc1\" class=\"wp-block-heading\">Dockerfile<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\nFROM alpine:3.19.1\n\n# ab\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u3002\nRUN apk add --no-cache apache2-utils\n\n# bash\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u3002\nRUN apk add --no-cache bash\n\n# whereis\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\nRUN apk add --no-cache util-linux\n\nENTRYPOINT &#x5B;&quot;top&quot;, &quot;-b&quot;]\n<\/pre><\/div>\n\n\n<h2 id=\"toc2\" class=\"wp-block-heading\">\u4f5c\u6210\u624b\u9806<\/h2>\n\n\n\n<p>Dockerfile \u304c\u5b58\u5728\u3059\u308b\u5834\u6240\u3067\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n% docker image build -t ab .\n<\/pre><\/div>\n\n\n<p>\u30a4\u30e1\u30fc\u30b8\u304c\u4f5c\u6210\u3055\u308c\u305f\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n% docker image ls\n<\/pre><\/div>\n\n\n<p>\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3057\u3066\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n% docker container run --name=ab -d ab\n<\/pre><\/div>\n\n\n<p>\u30b3\u30f3\u30c6\u30ca\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n% docker container ls\n<\/pre><\/div>\n\n\n<p>\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u306b\u5165\u308b\u305f\u3081\u306b\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n% docker container exec -it ab \/bin\/bash\n<\/pre><\/div>\n\n\n<p>ab\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# ab -n 100 -c 100 https:\/\/\u30b5\u30a4\u30c8\u306eURL\/\n<\/pre><\/div>\n\n\n<h2 id=\"toc3\" class=\"wp-block-heading\">Tips<\/h2>\n\n\n\n<h3 id=\"toc4\" class=\"wp-block-heading\">vim\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# apk add --no-cache vim\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u76ee\u7684 \u74b0\u5883\u3092\u6c5a\u3057\u305f\u304f\u306a\u3044\u306e\u3067\u3001ab\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u3060\u3051\u306bDocker\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3059\u308b\u3002 ab = Apache HTTP server Benchmarking tool Dockerfile \u4f5c\u6210\u624b\u9806 Dock [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,97],"tags":[32,98],"class_list":["post-1117","post","type-post","status-publish","format-standard","hentry","category-apache","category-docker","tag-apache","tag-docker"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1117"}],"version-history":[{"count":1,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1117\/revisions"}],"predecessor-version":[{"id":1118,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1117\/revisions\/1118"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}