{"id":34744,"date":"2023-04-11T22:12:14","date_gmt":"2023-01-01T07:32:17","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/"},"modified":"2024-04-29T23:01:40","modified_gmt":"2024-04-29T15:01:40","slug":"%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/","title":{"rendered":"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u5728\u6211\u4e4b\u524d\u53c2\u4e0e\u7684\u9879\u76ee\u4e2d\uff0c\u4f7f\u7528Docker\u955c\u50cf\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u59cb\u7ec8\u5b58\u5728\u91cd\u91cf\u8fc7\u5927\u7684\u95ee\u9898\u3002<\/p>\n<p>Docker\u30a4\u30e1\u30fc\u30b8\u304c\u91cd\u3044\u3068\u3001\u826f\u3044\u3053\u3068\u306f\u4e00\u3064\u3082\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u79c1\u306e\u7d4c\u9a13\u4e0a\u3067\u4e3b\u8981\u306a\u5177\u4f53\u4f8b\u3092\u4e0a\u3052\u308b\u3068\u2026<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u7a3c\u50cd\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u4f4e\u4e0b (\u7121\u99c4\u306a\u30ea\u30bd\u30fc\u30b9\u6d88\u8cbb)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d3\u30eb\u30c9(CI)\u306b\u304b\u304b\u308b\u6642\u9593\u306e\u5897\u5927<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30ed\u30fc\u30ab\u30eb\u958b\u767a\u304c\u91cd\u304f\u3066\u30b9\u30c8\u30ec\u30b9 (\u958b\u767a\u306b\u304b\u304b\u308b\u904b\u7528\u8ca0\u8377\u306e\u5897\u5927)<\/ul>\n<p>\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u60c5\u51b5\u5df2\u7ecf\u53d1\u751f\u4e86\u3002<\/p>\n<p>\u3069\u3046\u3044\u3046\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u308b\u3079\u304d\u304b\u306f\u3001Google\u304c\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u63d0\u5531\u3057\u3066\u3044\u308b\u3082\u306e\u304c\u6709\u540d\u3067\u3001\u4ee5\u4e0b\u306eatmarkIT\u306e\u8a18\u4e8b\u306a\u3069\u3067\u3082\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h1>\u4f60\u8bbe\u60f3\u7684\u662f\u4ec0\u4e48\u6837\u7684\u73af\u5883\uff1f<\/h1>\n<p>\u5728\u672c\u8282\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u65e0\u72b6\u6001\u7684\u7f51\u7edc\u670d\u52a1\u7684\u524d\u7aef\u90e8\u5206\u3002<\/p>\n<p>\u5728\u6982\u8ff0\u8d8a\u5177\u4f53\u7684\u5185\u5bb9\u4e4b\u524d\uff0c\u6700\u7ec8\u76ee\u6807\u662f\u5b9e\u73b0\u50cf Linux + Apache + PHP \u8fd9\u6837\u7684\u5e38\u89c1\u7684 WEB \u670d\u52a1\u5668\u5bb9\u5668\u4f5c\u4e3a\u524d\u7aef\u3002<\/p>\n<p>DB\u3084\u30ad\u30e3\u30c3\u30b7\u30e5\u5468\u308a\u306f\u3001SaaS\u3084\u4ed6\u306e\u30b3\u30f3\u30c6\u30ca\u306b\u4efb\u305b\u308b\u3082\u306e\u3068\u60f3\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h1>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u60a8\u5982\u4f55\u5904\u7406\u5c42\u6b21\u7ed3\u6784\uff1f<\/h1>\n<p>\u5148\u307b\u3069\u306eGoogle\u306e\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306b\u3082\u3042\u308b\u901a\u308a\u3001\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30a4\u30e1\u30fc\u30b8\u3092\u305d\u306e\u307e\u307e\u81ea\u5206\u306e (\u81ea\u793e\u306e) \u30b5\u30fc\u30d3\u30b9\u306b\u9069\u7528\u3067\u304d\u308b\u30b1\u30fc\u30b9\u306f\u5c11\u306a\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u6839\u636e\u67d0\u79cd\u516c\u5f00\u5f62\u8c61\uff0c\u7f16\u5199Dockerfile\u4ee5\u5f15\u5165\u7f3a\u5c11\u7684\u5e93\u548c\u5305\uff0c\u5e76\u6784\u5efa\u5e76\u90e8\u7f72\u670d\u52a1\u3002<\/p>\n<p>\u3053\u3053\u3067\u307e\u305a\u8003\u3048\u306a\u304f\u3066\u306f\u306a\u3089\u306a\u3044\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u30d3\u30eb\u30c9\u3059\u308b\u30ec\u30a4\u30e4\u30fc\u306f\u901a\u5e381\u3064\u3067\u306f\u53ce\u307e\u3089\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u9700\u8981\u8003\u8651\u7684\u662f\u5177\u4f53\u7684CI\u4e8b\u9879\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">OS\u3084\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306a\u3069\u3001\u57fa\u672c\u7684\u306a\u74b0\u5883\u3092\u5b9a\u7fa9\u3057\u3066\u30d3\u30eb\u30c9\u3059\u308b (1\u5c64\u76ee)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">CI\u3092\u56de\u3057\u3066 git clone \u3092\u884c\u3044\u3001\u6700\u65b0\u306e\u30a2\u30d7\u30ea\u72b6\u614b\u3092\u30d3\u30eb\u30c9\u3059\u308b (2\u5c64\u76ee)<\/ul>\n<p>\u3068\u3044\u3046\u3001\u6700\u4f4e2\u5c64\u306e\u69cb\u6210\u3068\u3059\u3079\u304d\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u30ec\u30a4\u30e4\u30fc\u306f\u5c11\u306a\u3051\u308c\u3070\u5c11\u306a\u3044\u307b\u3069\u3001\u5b8c\u6210\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u306f\u8efd\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001CI\u3092\u56de\u3057\u3066\u30d3\u30eb\u30c9\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u3092\u6bce\u56de\u6700\u521d\u304b\u3089\u4f5c\u3063\u3066\u3044\u305f\u306e\u3067\u306f\u3001\u3069\u3093\u306a\u306b\u8efd\u304f\u3067\u304d\u308b\u30c6\u30af\u30cb\u30c3\u30af\u3092\u99c6\u4f7f\u3057\u3066\u3044\u3066\u3082\u3001\u6bce\u56de\u76f8\u5fdc\u306e\u30d3\u30eb\u30c9\u6642\u9593\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u73fe\u5b9f\u7684\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u300c1\u5c64\u76ee\u300d\u306b\u3064\u3044\u3066\u3001\u540c\u69d8\u306e\u74b0\u5883\u3067\u52d5\u4f5c\u3059\u308b\u3044\u304f\u3064\u304b\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u540c\u3058\u30a4\u30e1\u30fc\u30b8\u3092\u5171\u7528\u3059\u308b\u65b9\u304c\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306b\u3068\u3063\u3066\u3082\u5229\u70b9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070OS\u306b\u8106\u5f31\u6027\u304c\u51fa\u305f\u3068\u304d\u306b\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u306eDockerfile\u306e FROM \u3092\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u3067\u3001\u5404\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u4e00\u5f8b\u306b\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u5fdc\u304c\u884c\u308f\u308c\u305f\u72b6\u614b\u3067\u3001\u3059\u3050\u30c7\u30d7\u30ed\u30a4\u3057\u76f4\u305b\u308b\u3053\u3068\u304c\u305d\u306e\u7406\u7531\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u3001\u79c1\u304c\u304b\u3064\u3066\u643a\u308f\u3063\u3066\u3044\u305f\u6848\u4ef6\u3067\u3082\u300c1\u5c64\u76ee\u300d\u3092\u5171\u901a\u5316\u3059\u308b\u3053\u3068\u81ea\u4f53\u306f\u30cd\u30ac\u30c6\u30a3\u30d6\u306a\u8981\u7d20\u3084\u610f\u898b\u306f\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u5834\u5408\u306b\u3088\u3063\u3066\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3054\u3068\u306e\u5dee\u3092\u5438\u53ce\u3059\u308b\u305f\u3081\u306b3\u5c64\u3068\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u30b1\u30fc\u30b9\u3082\u3042\u308b\u304b\u3082\u77e5\u308c\u307e\u305b\u3093\u3002\u8a73\u3057\u304f\u306f\u500b\u5225\u7684\u306a\u691c\u8a0e\u304c\u5fc5\u8981\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u4ece\u8fd9\u4e4b\u540e<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">1\u5c64\u76ee\u306e\u30d3\u30eb\u30c9\u30a4\u30e1\u30fc\u30b8\u3000\u2026\u3000\u30d9\u30fc\u30b9\u30a4\u30e1\u30fc\u30b8<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">2\u5c64\u76ee\u306e\u30d3\u30eb\u30c9\u30a4\u30e1\u30fc\u30b8\u3000\u2026\u3000CI\u30a4\u30e1\u30fc\u30b8<\/ul>\n<p>\u3068\u3044\u3046\u547c\u3073\u65b9\u3067\u8a71\u3092\u9032\u3081\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h1>\u53cd\u6a21\u5f0f<\/h1>\n<p>\u867d\u7136\u8fd9\u7eaf\u7cb9\u662f\u6211\u7684\u4e2a\u4eba\u770b\u6cd5\uff0c\u4f46\u6211\u5c06\u6839\u636e\u6211\u7684\u8fc7\u53bb\u7ecf\u9a8c\uff0c\u63d0\u51fa\u4e00\u4e2a\u4e0d\u597d\u7684\u57fa\u7840\u5f62\u8c61\u7ec4\u6210\u7684\u65b9\u5f0f\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>VM\u3067\u7a3c\u50cd\u3057\u3066\u308b\u30a4\u30f3\u30d5\u30e9\u306e\u4f5c\u308a\u65b9\u3092Dockerfile\u306b\u9069\u7528\u3059\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u8a00\u8a9e\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u3082\u3063\u3066\u30a4\u30e1\u30fc\u30b8\u3092\u5834\u5408\u5206\u3051\u3059\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u30a4\u30e1\u30fc\u30b8\u3092\u751f\u304b\u3055\u306a\u3044<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>OS\u306e\u30c7\u30a3\u30b9\u30c8\u30ea\u30d3\u30e5\u30fc\u30b7\u30e7\u30f3\u306b\u3053\u3060\u308f\u308b<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>Dockerfile\u3068\u3057\u3066\u8efd\u91cf\u306b\u3067\u304d\u308b\u8a18\u6cd5\/\u624b\u6cd5\u3092\u4f7f\u308f\u306a\u3044<\/ol>\n<p>\u4e3b\u306b\u3053\u306e5\u70b9\u3060\u3068\u8003\u3048\u307e\u3059\u3002<br \/>\n\u30ab\u30c6\u30b4\u30ea\u3054\u3068\u3068\u3044\u3046\u3088\u308a\u3082\u3001\u30cf\u30de\u308a\u305d\u3046\u306a\u9806\u306b\u66f8\u3044\u3066\u307e\u3059\u3002\u3002\u3002<\/p>\n<p>\u7531\u4e8e\u5728\u4e00\u7bc7\u6587\u7ae0\u4e2d\u53ef\u80fd\u4e0d\u592a\u5bb9\u6613\u7406\u89e3\uff0c\u6240\u4ee5\u6211\u4f1a\u5728\u4e0b\u9762\u4ee5\u8be6\u7ec6\u8bf4\u660e\u7684\u65b9\u5f0f\u8fdb\u884c\u9010\u4e00\u89e3\u91ca\u3002<\/p>\n<h2>1. VM\u3067\u7a3c\u50cd\u3057\u3066\u308b\u30a4\u30f3\u30d5\u30e9\u306e\u4f5c\u308a\u65b9\u3092Dockerfile\u306b\u9069\u7528\u3059\u308b<\/h2>\n<p>\u3053\u308c\u304b\u3089\u672c\u756a\u3067Docker\u3092\u63a1\u7528\u3057\u3088\u3046\u3068\u3059\u308b\u4f01\u696d (\u30c1\u30fc\u30e0) \u306b\u3068\u3063\u3066\u3001\u6700\u3082\u3042\u308b\u3068\u601d\u308f\u308c\u308b\u30d1\u30bf\u30fc\u30f3\u3002\u4f8b\u3048\u3070 AWS EC2 \u306e\u30aa\u30fc\u30c8\u30b9\u30b1\u30fc\u30eb\u74b0\u5883\u3067\u7a3c\u50cd\u3057\u3066\u3044\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30b3\u30f3\u30c6\u30ca\u5316\u3059\u308b\u2026\u306a\u3069\u306e\u8981\u4ef6\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e00\u898b\u3059\u308b\u3068\u3001Dockerfile\u306f\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3068\u307b\u307c\u540c\u69d8\u306b\u8aad\u3081\u308b\u306e\u3067\u3001VM\u3067\u300e\u5b89\u5b9a\u7a3c\u50cd\u300f\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d0\u30a4\u30f3\u30d5\u30e9\u306e\u4f5c\u308a\u3092\u305d\u306e\u307e\u307e\u3001\u3042\u308b\u3044\u306f\u4f3c\u305f\u3082\u306e\u3092\u79fb\u690d\u3057\u305f\u304f\u306a\u308b\u304b\u3082\u77e5\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u3053\u308c\u306f\u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002<\/p>\n<p>\u672c\u9805\u3067\u306f\u4e3b\u306bPHP\u74b0\u5883\u3092\u6271\u3046\u306e\u3067\u3059\u304c\u3001PHP\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u3084\u308a\u65b9\u3068\u3057\u3066\u306f\u3001\u57fa\u672c\u7684\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a3\u3064\u306e\u65b9\u6cd5\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30bd\u30fc\u30b9\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb (\u516c\u5f0f\u63a8\u5968)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">yum \u3084 apt \u306a\u3069OS\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u7ba1\u7406\u30c4\u30fc\u30eb\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">.rpm \u3084 .deb \u306a\u3069\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u7528\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/ul>\n<p>\u5982\u679c\u5728\u865a\u62df\u673a\u4e0a\u6784\u5efa\u7684\u8bdd\uff0c\u5f88\u53ef\u80fd\u4f1a\u9009\u62e9\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff0c\u4f46\u4e0d\u5e94\u8be5\u5728Docker\u4e0a\u505a\u540c\u6837\u7684\u4e8b\u60c5\u3002<\/p>\n<p>\u65e0\u8bba\u91c7\u53d6\u54ea\u79cd\u65b9\u6cd5\uff0c\u5904\u7406\u4e0a\u90fd\u4f1a\u6709\u5f88\u9ad8\u7684\u6210\u672c\uff0c\u7ed9\u5f62\u8c61\u589e\u52a0\u4e86\u8d1f\u62c5\u3002<\/p>\n<p>\u8a73\u3057\u304f\u306f\u5f8c\u307b\u3069\u307e\u305f\u89e6\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>2. \u8a00\u8a9e\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u3082\u3063\u3066\u30a4\u30e1\u30fc\u30b8\u3092\u5834\u5408\u5206\u3051\u3059\u308b<\/h2>\n<p>\u5148\u307b\u3069\u3001\u300c\u540c\u69d8\u306e\u74b0\u5883\u3067\u52d5\u4f5c\u3059\u308b\u3044\u304f\u3064\u304b\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3001\u540c\u3058\u30a4\u30e1\u30fc\u30b8\u3092\u5171\u7528\u3059\u308b\u65b9\u304c\u826f\u3044\u300d\u3068\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u5982\u679c\u4ece\u7ed3\u8bba\u4e0a\u6765\u5199\uff0c\u8fd9\u5e76\u4e0d\u662f\u6307\u6b63\u5728\u8ba8\u8bbaPHP5.6\u5f00\u53d1\u7684\u5e94\u7528\u548cPHP7.0\u5f00\u53d1\u7684\u5e94\u7528\u4e4b\u95f4\u7684\u5dee\u5f02\u3002<\/p>\n<p>\u3053\u3053\u3067\u306e\u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\u306f\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u6307\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u540c\u3058PHP7.0\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3082\u3001\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u7570\u306a\u308b\u3068\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u7570\u306a\u3063\u3066\u304d\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u8907\u6570\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u5bfe\u5fdc\u3055\u305b\u305f\u30a4\u30e1\u30fc\u30b8\u306f\u3001\u591a\u6570\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u76db\u308a\u8fbc\u3080\u5fc5\u8981\u304c\u3042\u308a\u3001\u3088\u308a\u91cd\u91cf\u7d1a\u306b\u306a\u308a\u304c\u3061\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u540c\u8a00\u8a9e\u306e\u540c\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5f8c\u304b\u3089\u5225\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u5bfe\u5fdc\u3055\u305b\u3088\u3046\u3068\u3057\u305f\u5834\u5408\u3001\u8ffd\u52a0\u3067\u5225\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u5c0e\u5165\u3059\u308b\u5fc5\u8981\u3082\u751f\u3058\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u7d50\u679c\u7684\u306b\u3001\u4ed6\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u5f71\u97ff\u3092\u4e0e\u3048\u5b89\u5b9a\u6027\u3092\u640d\u306a\u3046\u539f\u56e0\u306b\u306a\u3063\u305f\u308a\u3001Dockerfile\u306e\u8907\u96d1\u5316\u30fb\u3055\u3089\u306a\u308b\u91cd\u91cf\u5316\u3092\u3082\u305f\u3089\u3057\u307e\u3059\u3002<\/p>\n<p>\u91cd\u8981\u306a\u306e\u306f\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u65b9\u6cd5\u3067\u3059\u3002 y\u01d4 de , de sh\u00ec de .)<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3054\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3054\u3068<\/ul>\n<p>\u5728\u8fd9\u65b9\u9762\uff0c\u6211\u8ba4\u4e3a\u4ee5\u4e24\u4e2a\u89d2\u5ea6\u5206\u5f00\u5e76\u52aa\u529b\u8fbe\u5230\u5171\u540c\u5316\u66f4\u4e3a\u81ea\u7136\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e0d\u4f9d\u8d56\u6846\u67b6\u7684\u8bed\u8a00\u6216\u8005\u6846\u67b6\u672c\u8eab\u7684\u5f00\u53d1\u901f\u5ea6\u5f88\u6162\uff08\u7ecf\u5e38\u6709\u53ea\u60f3\u5347\u7ea7\u8bed\u8a00\u7248\u672c\u7684\u9700\u6c42\uff09\uff0c\u5219\u60c5\u51b5\u53ef\u80fd\u4e0d\u9002\u7528\u3002\u6211\u8ba4\u4e3a\u9700\u8981\u8003\u8651\u5176\u4ed6\u65b9\u6848\u3002<\/p>\n<h2>3. \u4e0d\u5229\u7528\u5df2\u516c\u5f00\u7684\u5f62\u8c61<\/h2>\n<ol>\u5c31\u50cf\u6211\u4e4b\u524d\u5199\u7684\u90a3\u6837\uff0c\u4ece\u96f6\u5f00\u59cb\u6784\u5efa\u8bed\u8a00\u73af\u5883\u7684\u8fc7\u7a0b\u975e\u5e38\u7e41\u91cd\u3002<\/ol>\n<p>Docker Hub\u306b\u306f\u591a\u6570\u306e\u30a4\u30e1\u30fc\u30b8\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8efd\u3044Docker\u30a4\u30e1\u30fc\u30b8\u3092\u4f5c\u308b\u30b3\u30c4\u306f\u3001\u5b9f\u73fe\u3057\u305f\u3044\u74b0\u5883\u306b\u8fd1\u3044\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u3092\u57fa\u306b\u3057\u3066Dockerfile\u3092\u66f8\u304f\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u5177\u4f53\u7684\u306b\u306f\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u52d5\u4f5c\u3055\u305b\u308b\u305f\u3081\u306e\u8a00\u8a9e\u74b0\u5883\u3092\u57fa\u6e96\u306b\u3057\u305f\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u3088\u308a\u826f\u3044\u3068\u8003\u3048\u307e\u3059\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u521b\u5efaDocker\u955c\u50cf\uff1f<\/p>\n<p>\u5bf9\u4e8e\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u5e94\u8be5\u660e\u786e\u56de\u7b54\u4e3a\u4e86\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002\u9009\u62e9\u4e0e\u76ee\u6807\u5339\u914d\u7684\u6700\u4f73\u56fe\u50cf\u662f\u6211\u4eec\u6240\u9700\u7684\u7b2c\u4e00\u6b65\u3002<\/p>\n<p>\u4e0d\u8003\u8651\u57fa\u672c\u8f7b\u91cf\u5316\u548c\u6700\u4f18\u56fe\u50cf\uff0c\u8fd9\u5c31\u662f\u53cd\u6a21\u5f0f\u7684\u8868\u73b0\u3002<\/p>\n<p>Node.js\u3001Python\u3001Go\u3001Ruby\u7b49\u7b49\u2026\u2026\u7531\u4e8e\u6bcf\u79cd\u8bed\u8a00\u90fd\u6709\u5b98\u65b9\u7684\u6587\u6863\uff0c\u6240\u4ee5\u6700\u597d\u5148\u67e5\u770b\u5b98\u65b9\u6587\u6863\u3002<\/p>\n<p>https:\/\/hub.docker.com\/_\/node\/ -&gt; Node\u7684Docker\u955c\u50cf\u4ed3\u5e93<br \/>\nhttps:\/\/hub.docker.com\/_\/python\/ -&gt; Python\u7684Docker\u955c\u50cf\u4ed3\u5e93<br \/>\nhttps:\/\/hub.docker.com\/_\/golang\/ -&gt; Golang\u7684Docker\u955c\u50cf\u4ed3\u5e93<br \/>\nhttps:\/\/hub.docker.com\/_\/ruby\/ -&gt; Ruby\u7684Docker\u955c\u50cf\u4ed3\u5e93<\/p>\n<p>\u5f53\u8c08\u5230PHP\u73af\u5883\u7684\u6784\u5efa\u65f6\uff0cPHP\u6269\u5c55\u7684\u53d1\u5c55\u5386\u53f2\u76f8\u5f53\u590d\u6742\uff0c\u5927\u81f4\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u4e09\u79cd\u6a21\u5f0f\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5728PHP\u6e90\u4ee3\u7801\u4e2d\u5305\u542b\u7684\u4e1c\u897f<\/ol>\n<\/li>\n<\/ol>\n<p>\u7531\u5916\u90e8\u63d0\u4f9b\u7684\u4f7f\u7528C\u8bed\u8a00\u5f00\u53d1\u7684\uff08\u901a\u8fc7pecl\u547d\u4ee4\u5b89\u88c5\uff09<br \/>\n\u7531\u5916\u90e8\u63d0\u4f9b\u7684\u4f7f\u7528PHP\u5f00\u53d1\u7684\uff08\u901a\u8fc7composer\u547d\u4ee4\u5b89\u88c5\uff09<\/p>\n<p>\u5728\u8003\u8651PHP\u7684\u5b9e\u9645\u8fd0\u7528\u65f6\uff0c\u9700\u8981\u638c\u63e1\u65e0\u6cd5\u4ea4\u7531composer\u5904\u7406\u76841. 2.\u7684\u5904\u7406\u65b9\u6cd5\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u5728https:\/\/hub.docker.com\/_\/php\u4e0a\u5199\u7740\u5982\u4e0b\u5185\u5bb9\uff0c<\/p>\n<blockquote><p>\u6211\u4eec\u63d0\u4f9b\u4e86\u8f85\u52a9\u811a\u672cdocker-php-ext-configure\u3001docker-php-ext-install\u548cdocker-php-ext-enable\uff0c\u4ee5\u4fbf\u66f4\u8f7b\u677e\u5730\u5b89\u88c5PHP\u6269\u5c55\u3002<\/p><\/blockquote>\n<p>\u53e6\u5916\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u4f8b\u5b50\uff0c\u4e0b\u9762\u662f\u4e00\u4e2aDockerfile\u7684\u4ecb\u7ecd\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"k\">FROM<\/span><span class=\"s\"> php:7.4-fpm<\/span>\r\n<span class=\"k\">RUN <\/span>apt-get update <span class=\"o\">&amp;&amp;<\/span> apt-get <span class=\"nb\">install<\/span> <span class=\"nt\">-y<\/span> <span class=\"se\">\\\r\n<\/span>        libfreetype6-dev <span class=\"se\">\\\r\n<\/span>        libjpeg62-turbo-dev <span class=\"se\">\\\r\n<\/span>        libpng-dev <span class=\"se\">\\\r\n<\/span>    <span class=\"o\">&amp;&amp;<\/span> docker-php-ext-configure gd <span class=\"nt\">--with-freetype<\/span> <span class=\"nt\">--with-jpeg<\/span> <span class=\"se\">\\\r\n<\/span>    <span class=\"o\">&amp;&amp;<\/span> docker-php-ext-install <span class=\"nt\">-j<\/span><span class=\"si\">$(<\/span><span class=\"nb\">nproc<\/span><span class=\"si\">)<\/span> gd\r\n<\/code><\/pre>\n<p>\u5728\u8fd9\u91cc\uff0c\u4f5c\u4e3a\u4e00\u4e2a\u4f8b\u5b50\u63d0\u5230\u4e86\u5b89\u88c5 php-gd\uff0c\u4f46\u9664\u4e86\u8fd9\u4e2a\u4e4b\u5916\uff0c\u4e00\u822c\u6765\u8bf4\u8fd8\u6709\u591a\u79cd\u65b9\u6cd5\uff0c\u6bd4\u5982\u5728\u64cd\u4f5c\u7cfb\u7edf\u7684\u53d1\u884c\u7248\u6216 PHP \u81ea\u8eab\u7684\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u90fd\u53ef\u4ee5\u8fdb\u884c\u3002<\/p>\n<p>\u5982\u679c\u80fd\u591f\u4ec5\u901a\u8fc7docker-php-ext-install\u7b49\u547d\u4ee4\u6765\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u80fd\u4f1a\u66f4\u6709\u597d\u5904&#8230;&#8230;\u6211\u8ba4\u4e3a\u3002\u4f46\u662f\uff0c\u5f52\u7ed3\u8d77\u6765\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5e76\u4e0d\u6210\u529f&#8230;&#8230;\u8bf7\u53c2\u9605\u540e\u7eed\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n<h2>4. \u5bf9\u64cd\u4f5c\u7cfb\u7edf\u7684\u53d1\u884c\u7248\u6709\u6240\u504f\u597d<\/h2>\n<p>\u5bf9\u4e8e\u90a3\u4e9b\u7a33\u5b9a\u8fd0\u8425\u7740\u73b0\u6709\u670d\u52a1\u7684\u5de5\u7a0b\u5e08\uff08\u5c24\u5176\u662f\u90a3\u4e9b\u6df1\u5ea6\u53c2\u4e0e\u8fd0\u8425\u7684\u5de5\u7a0b\u5e08\u6765\u8bf4\uff09\uff0c\u4ed6\u4eec\u8fc7\u53bb\u4f7f\u7528\u8fc7\u5e76\u4e14\u6df1\u611f\u60c5\u7eea\u4f9d\u604b\u7684Linux\u53d1\u884c\u7248\u662f\u4e00\u4e2a\u4e0d\u53ef\u5ffd\u89c6\u7684\u91cd\u8981\u56e0\u7d20\u3002<\/p>\n<p>\u7136\u800c\uff0c\u5c31\u50cf\u57283\u4e2d\u6240\u8ff0\uff0c\u521b\u5efa\u5bb9\u5668\u73af\u5883\u7684\u552f\u4e00\u76ee\u7684\u5c31\u662f\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff0c\u800c\u4e0d\u8003\u8651\u64cd\u4f5c\u7cfb\u7edf\u7684\u7c7b\u578b\u3002<\/p>\n<p>\u5728\u7c7b\u4f3c\u5bb9\u5668\u7684\u5b9a\u4e49\u6027\uff08\u58f0\u660e\u6027\uff09\u57fa\u7840\u8bbe\u65bd\u4e2d\uff0c\u53ea\u8981\u786e\u5b9a\u5176\u4f5c\u4e3a\u903b\u8f91\u7684\u6b63\u5e38\u8fd0\u884c\uff0c\u5c31\u53ef\u4ee5\u5b89\u5168\u5730\u8fdb\u884c\u7a33\u5b9a\u8fd0\u4f5c\u3002<br \/>\n\u5728\u4eceVM\u73af\u5883\u8fc1\u79fb\u5230\u5bb9\u5668\u4e0a\u7684\u65f6\u5019\uff0c\u7279\u522b\u9700\u8981\u6ce8\u91cd\u8fdb\u884c\u5168\u9762\u7684\u529f\u80fd\u6d4b\u8bd5\u3002<br \/>\n\uff08\u5f53\u7136\uff0c\u9002\u5f53\u7684\u6269\u5c55\u6216\u81ea\u52a8\u6269\u5c55\u4e5f\u662f\u5fc5\u8981\u7684\uff09<\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u4e00\u79cd\u8f7b\u91cf\u7ea7Linux\u53d1\u884c\u7248Alpine\u3002<\/p>\n<p>\u963f\u5c14\u5351\u65af\u662f\u8fd1\u5e74\u6765\u5728Docker\u793e\u533a\u5907\u53d7\u5173\u6ce8\u7684\uff0c\u540c\u65f6\u5728\u67e5\u770bDocker Hub\u7684\u5b98\u65b9PHP\u955c\u50cf\u65f6\uff0c\u53d1\u73b0\u5b83\u975e\u5e38\u8f7b\u91cf\uff0c\u76f8\u8f83\u4e8e\u6807\u51c6\u7684Debian\u6765\u8bf4\u3002<\/p>\n<h2>\u4e0d\u4f7f\u7528\u53ef\u4ee5\u4f7fDockerfile\u66f4\u7b80\u6d01\u8f7b\u91cf\u7684\u8bed\u6cd5\/\u65b9\u6cd5\u3002<\/h2>\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u4e3b\u8981\u4ecb\u7ecd\u5728\u7f51\u4e0a\u641c\u7d22\u65f6\u7ecf\u5e38\u51fa\u73b0\u7684\u4e00\u7cfb\u5217\u4fe1\u606f\u3002<\/p>\n<p>\u5373\u4f7f\u65e0\u6cd5\u7acb\u5373\u5927\u5e45\u66f4\u6539\u6b63\u5728\u4f7f\u7528\u7684Dockerfile\u7ed3\u6784\uff0c\u5982\u679c\u5c1a\u672a\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c\uff0c\u4ecd\u53ef\u671f\u671b\u9002\u5f53\u7684\u8f7b\u91cf\u5316\u3002<\/p>\n<ul class=\"post-ul\">\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u524a\u9664\u3059\u308b (apt, yum, apk \u306a\u3069\u5229\u7528\u3059\u308b\u5834\u5408)<\/ul>\n<pre class=\"post-pre\"><code>\u4f8b\uff1a\r\n (\u203b \u5b9f\u969b\u306b\u306fDockerfile\u306e\u5f62\u5f0f\u306b\u5408\u308f\u305b\u305f\u6700\u9069\u5316\u304c\u5fc5\u8981)\r\n\r\n# apt clean\r\n\u3000\u307e\u305f\u306f\r\n# rm -rf \/var\/cache\/apt\/*\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30bd\u30fc\u30b9\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u884c\u3046\u5834\u5408\u306f\u3001tar\u30dc\u30fc\u30eb\u3084\u30d3\u30eb\u30c9\u3057\u305f\u30bd\u30fc\u30b9\u3092\u524a\u9664\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u2192\u3000\u4e00\u822c\u306e\u30b5\u30fc\u30d0\u904b\u7528\u3067\u3042\u308c\u3070\u4fdd\u6301\u3057\u3066\u304a\u304f\u3079\u304d\u3067\u3059\u304c\u3001\u30b3\u30f3\u30c6\u30ca\u3067\u306f\u7d99\u7d9a\u904b\u7528\u3057\u306a\u3044\u305f\u3081\u3002<\/ul>\n<pre class=\"post-pre\"><code>\u4f8b\uff1a\r\n (\u203b \u5b9f\u969b\u306b\u306fDockerfile\u306e\u5f62\u5f0f\u306b\u5408\u308f\u305b\u305f\u6700\u9069\u5316\u304c\u5fc5\u8981)\r\n\r\n# cd \/usr\/local\/src\/httpd-2.4.9\r\n# .\/configure --prefix=\/opt\/httpd\/httpd-2.4.9 --with-apr=\/opt\/apr\/apr-1.5.1 --with-apr-util=\/opt\/apr-util\/apr-util-1.5.3\r\n# make\r\n# make install\r\n\r\n\/\/ \u3053\u306e\u90e8\u5206\u304c\u8a72\u5f53\r\n# make clean\r\n# rm -rf \/usr\/local\/src\/httpd-2.4.9\/\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5834\u5408\u306b\u3088\u308a\u30de\u30eb\u30c1\u30b9\u30c6\u30fc\u30b8\u30d3\u30eb\u30c9\u3092\u6d3b\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u2192\u3000\u4e00\u822c\u306b\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u306f\u8efd\u3044\u306e\u3068\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u306e\u30b9\u30c6\u30fc\u30b8\u3092\u5206\u96e2\u3057\u3066\u8907\u6570\u30a4\u30e1\u30fc\u30b8\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u8efd\u91cf\u5316\u306b\u52b9\u679c\u3092\u767a\u63ee\u3059\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ADD \u3088\u308a COPY \u3092\u5229\u7528\u3059\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u2192\u3000\u8a73\u7d30\u306f\u516c\u5f0f\u306b\u4efb\u305b\u3066\u5272\u611b\u3057\u307e\u3059\u304c\u3001\u6a5f\u80fd\u304c\u9055\u3046\u306e\u3067 COPY \u3092\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">https:\/\/docs.docker.com\/develop\/develop-images\/dockerfile_best-practices\/#add-or-copy<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">RUN, COPY \u306a\u3069\u306e\u51e6\u7406\u306f\u306a\u308b\u3079\u304f\u307e\u3068\u3081\u308b<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u2192\u3000\u5177\u4f53\u7684\u306b\u306f\u3001 \\ \u3084 &amp;&amp; \u3067\u7d50\u5408\u3057RUN\u306f1\u56de\u306b\u3057\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3000\u3000RUN\u3092\u6b21\u3005\u306b\u4e26\u3079\u3066\u66f8\u304f\u3088\u3046\u306a\u3084\u308a\u65b9\u306f\u30b9\u30de\u30fc\u30c8\u3067\u306a\u3044\u3060\u3051\u3067\u306a\u304f\u3001\u8907\u96d1\u306a\u51e6\u7406\u306b\u306a\u308b\u3068\u30a4\u30e1\u30fc\u30b8\u30b5\u30a4\u30ba\u306b\u5f71\u97ff\u3059\u308b\u5834\u5408\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30d3\u30eb\u30c9\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u4f59\u8a08\u306a\u3082\u306e\u3092\u7f6e\u304b\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u2192\u3000COPY \u306e\u4f7f\u3044\u65b9\u3057\u3060\u3044\u3067\u904b\u3070\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u2026<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u3000\u3000\u4f55\u304b\u306e\u4e8b\u60c5\u3067\u907f\u3051\u3089\u308c\u306a\u3044\u5834\u5408\u306f .dockerignore \u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002<\/ul>\n<h1>\u5c1d\u8bd5\u521b\u5efa\u4e00\u4e2a\u53ef\u4ee5\u8fd0\u884cLaravel 7.x\u7684\u57fa\u672c\u955c\u50cf\u3002<\/h1>\n<p>\u624b\u5143\u306b Laravel 7.x \u3092\u5229\u7528\u3057\u3066\u958b\u767a\u3057\u305f\u30c6\u30b9\u30c8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u3042\u308b\u305f\u3081\u3001\u3053\u308c\u3092\u672c\u756a\u76f8\u5f53\u3067\u52d5\u4f5c\u53ef\u80fd\u3068\u3059\u308b\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u3092\u8003\u3048\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u3001Docker Hub\u306ePHP\u516c\u5f0f\u304b\u3089\u9069\u5f53\u3068\u601d\u308f\u308c\u308b\u30a4\u30e1\u30fc\u30b8\u3092\u898b\u7e55\u3044\u307e\u3059\u3002<\/p>\n<p>\u9451\u65bc\u524d\u63d0\u662f\u9700\u8981 PHP &gt;= 7.2.5\uff0c\u56e0\u6b64\u6211\u5e0c\u671b\u5c07 PHP \u7684\u7248\u672c\u8a2d\u5b9a\u70ba\u6700\u63a5\u8fd1\u6700\u4f4e\u9650\u7684\u7248\u672c 7.3\u3002<br \/>\nhttps:\/\/readouble.com\/laravel\/7.x\/ja\/installation.html<\/p>\n<p>\u5728\u8fd9\u91cc\uff0c\u9700\u8981\u8003\u8651\u7684\u8981\u70b9\u6709\u56db\u4e2a\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Alpine\u304c\u30d9\u30fc\u30b9OS\u3068\u306a\u3063\u3066\u3044\u308b\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">2.4\u7cfb\u306eApache\u304c\u6700\u521d\u304b\u3089\u5165\u3063\u3066\u3044\u308b\u3068\u3001\u306a\u304a\u30d9\u30b9\u30c8<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">ZTS\u306f\u5fc5\u8981\u306a\u3044<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">worker\u7cfb\u306eMPM\u306f\u4f7f\u7528\u3057\u306a\u3044\u306e\u3067\u3001FPM\u3082\u5fc5\u8981\u306a\u3044<\/ul>\n<p>\u5927\u81f4\u4e0a\u770b\u8d77\u6765\u662f\u8fd9\u6837\u7684\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">php:7.3-alpine3.12<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">php:7.3-apache<\/ul>\n<p>\u4ece\u91cd\u70b9\u7684\u89d2\u5ea6\u6765\u770b\uff0c\u6ca1\u6709\u4efb\u4f55\u5df2\u5b89\u88c5\u4e86Alpine\u548cApache\u7684\u9009\u9879\u53ef\u4f9b\u9009\u62e9\u3002\u5173\u4e8ephp:7.3-apache\uff0c\u64cd\u4f5c\u7cfb\u7edf\u662fDebian 10\uff08buster\uff09\u3002<\/p>\n<p>\u4e00\u65e6\u5728\u672c\u5730\u7535\u8111\u4e0a\u5c06\u5b83\u4eec\u62c9\u53d6\uff0c\u8fdb\u884c\u539f\u59cb\u56fe\u50cf\u5c3a\u5bf8\u7684\u6bd4\u8f83\u3002<\/p>\n<pre class=\"post-pre\"><code>$ docker pull php:7.3-alpine3.12\r\n$ docker pull php:7.3-apache\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>$ docker images\r\nREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\r\nphp                 7.3-alpine3.12      898191dd6734        8 days ago          74.3MB\r\nphp                 7.3-apache          4c443398a62c        8 days ago          410MB\r\n<\/code><\/pre>\n<p>\u8bf4\u5b9e\u8bdd\uff0c\u5b8c\u5168\u6ca1\u6709\u53ef\u6bd4\u6027&#8230;<\/p>\n<p>\u5c3d\u7ba1Apache\u672a\u5305\u542b\u5728\u5185\uff0c\u7531\u4e8eAlpine\u975e\u5e38\u8f7b\u91cf\u5316\uff0c\u5373\u4f7f\u52a0\u8f7d\u4e86\u5927\u91cf\u7684\u8f6f\u4ef6\u5305\uff0c\u4e5f\u4e0d\u53ef\u80fd\u8fbe\u5230buster\u955c\u50cf\u7684\u7a0b\u5ea6\u3002<\/p>\n<p>\u6211\u4eec\u5c06\u91c7\u7528 php:7.3-alpine3.12 \u7684\u955c\u50cf\u6765\u8fdb\u884c\u3002<\/p>\n<h2>\u786e\u8ba4\u4e00\u4e0b php:7.3-alpine3.12 \u7684\u88f8\u955c\u50cf\u7f3a\u5c11\u4ec0\u4e48\u3002<\/h2>\n<p>\u8fd4\u56de Laravel 7.x \u7684\u5b89\u88c5\u8981\u6c42\u3002<br \/>\nhttps:\/\/readouble.com\/laravel\/7.x\/ja\/installation.html<\/p>\n<p>\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">PHP &gt;= 7.2.5<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">BCMath PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Ctype PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Fileinfo PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">JSON PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Mbstring PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">OpenSSL PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">PDO PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Tokenizer PHP\u62e1\u5f35<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">XML PHP\u62e1\u5f35<\/ul>\n<p>\u4ece\u57fa\u7840\u955c\u50cf\u542f\u52a8\u5bb9\u5668\uff0c\u7136\u540e\u9010\u6b65\u68c0\u67e5\u6240\u9700\u5185\u5bb9\u662f\u5426\u5b8c\u5584\u3002<\/p>\n<pre class=\"post-pre\"><code>$ docker images\r\nREPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\r\nphp                 7.3-alpine3.12      898191dd6734        8 days ago          74.3MB\r\nphp                 7.3-apache          4c443398a62c        8 days ago          410MB\r\n$ docker run -it -d -p 8000:80 898191dd6734        \/\/ http:\/\/127.0.0.1:8000 \u3067PC\u76ee\u8996\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u8a2d\u5b9a\r\n$ docker ps\r\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES\r\nb7a35b6625d7        d6096778d65d        \"docker-php-entrypoi\u2026\"   7 seconds ago       Up 5 seconds        0.0.0.0:8000-&gt;80\/tcp   wizardly_meitner\r\n<\/code><\/pre>\n<p>\u6211\u5728\u672c\u5730\u7684\u7535\u8111\u4e0a\u6267\u884c\u4e86\u5230\u8fd9\u91cc\u4e3a\u6b62\u7684\u64cd\u4f5c\u3002<br \/>\n\u63a5\u4e0b\u6765\u6211\u5c06\u767b\u5f55\u5230\u5bb9\u5668\u4e2d\uff0c\u5e76\u8c03\u67e5\u4e00\u4e0b\u5e93\u7684\u72b6\u51b5\u3002<\/p>\n<pre class=\"post-pre\"><code>$ docker exec -it b7a35b6625d7 \/bin\/sh\r\n\r\n\/ # php -m\r\n[PHP Modules]\r\nCore\r\nctype\r\ncurl\r\ndate\r\ndom\r\nfileinfo\r\nfilter\r\nftp\r\nhash\r\niconv\r\njson\r\nlibxml\r\nmbstring\r\nmysqlnd\r\nopenssl\r\npcre\r\nPDO\r\npdo_sqlite\r\nPhar\r\nposix\r\nreadline\r\nReflection\r\nsession\r\nSimpleXML\r\nsodium\r\nSPL\r\nsqlite3\r\nstandard\r\ntokenizer\r\nxml\r\nxmlreader\r\nxmlwriter\r\nzlib\r\n\r\n[Zend Modules]\r\n\r\n<\/code><\/pre>\n<p>\u9664\u4e86bcmath\u4e4b\u5916\uff0c\u4f3c\u4e4e\u8fd8\u6709\u5176\u4ed6\u7684\u65b9\u6cd5\u2026 \u4f46\u662f\u5149\u51ed\u8fd9\u4e9b\u8fd8\u4e0d\u8db3\u4ee5\u5f97\u51fa\u4e00\u4e2a\u7ed3\u8bba\uff0c\u9700\u8981\u66f4\u591a\u7684\u4fe1\u606f\u3002<\/p>\n<p>\u4e0e\u4f7f\u7528yum\u6216apt\u65f6\u4e0d\u540c\uff0c\u5b98\u65b9\u955c\u50cf\u662f\u57fa\u4e8e\u6e90\u4ee3\u7801\u6784\u5efa\u7684PHP\uff0c\u56e0\u6b64\u6700\u7ec8\u8fd8\u662f\u9700\u8981\u5b89\u88c5\u5404\u4e2a\u5e93\u3002<\/p>\n<p>\u4e3a\u4e86\u786e\u8ba4\u8fd9\u4e00\u70b9\uff0c\u6700\u597d\u4f7f\u7528php -i\u6216\u8005\u5728WEB\u6d4f\u89c8\u5668\u4e2d\u8bbe\u7f6ephpinfo\u6765\u8fdb\u884c\u8003\u8651\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"cp\">&lt;?php<\/span>\r\n<span class=\"nb\">phpinfo<\/span><span class=\"p\">();<\/span>\r\n<span class=\"cp\">?&gt;<\/span>\r\n<\/code><\/pre>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1f1637434c4406c18c3d\/110-0.png\" alt=\"bcmath_support_enable.png\" \/><\/div>\n<p>\u53e6\u5916\uff0c\u6211\u4e5f\u786e\u8ba4\u4e86\u4e0b\u5217\u4e8b\u9879\u3002<\/p>\n<pre class=\"post-pre\"><code>\/ # date\r\nSat Jun 20 12:11:15 UTC 2020\r\n\/ # which composer        \/\/ \u51fa\u529b\u306a\u3057\r\n\/ # which npm             \/\/ \u51fa\u529b\u306a\u3057\r\n<\/code><\/pre>\n<p>\u8003\u8651\u5230\u65f6\u533a\u4e3aUTC\u5e76\u4e14\u5728Laravel 7\u4e2d\u7f3a\u5c11\u5fc5\u8981\u7684\u547d\u4ee4\uff0c\u6211\u4eec\u51b3\u5b9a\u8fdb\u884c\u4e00\u4e9b\u8c03\u6574\u3002\u6b64\u5916\uff0c\u7531\u4e8e\u9700\u8981MySQL\u8fde\u63a5\uff0c\u8fd8\u9700\u8981\u5b89\u88c5\u8fd9\u4e9b\u5e93\u3002<\/p>\n<h2>\u5b9e\u9645\u7f16\u5199\u7684Dockerfile<\/h2>\n<pre class=\"post-pre\"><code><span class=\"k\">FROM<\/span><span class=\"s\"> php:7.3-alpine3.12<\/span>\r\n\r\n<span class=\"c\"># Document Root<\/span>\r\n<span class=\"k\">RUN <\/span><span class=\"nb\">mkdir<\/span> \/application\r\n\r\n<span class=\"c\"># Package Install<\/span>\r\n<span class=\"k\">RUN <\/span>apk update <span class=\"o\">&amp;&amp;<\/span> apk add <span class=\"nt\">--no-cache<\/span> git tzdata apache2 npm <span class=\"se\">\\\r\n<\/span>    php7-common php7-apache2 php7-bcmath php7-ctype  php7-fileinfo php7-json <span class=\"se\">\\\r\n<\/span>    php7-mbstring php7-openssl php7-pdo php7-mbstring php7-tokenizer php7-xml <span class=\"se\">\\\r\n<\/span>    php7-session php7-pdo_mysql php7-mysqli <span class=\"se\">\\\r\n<\/span>  <span class=\"o\">&amp;&amp;<\/span> <span class=\"nb\">cp<\/span> \/usr\/share\/zoneinfo\/Asia\/Tokyo \/etc\/localtime <span class=\"se\">\\\r\n<\/span>  <span class=\"o\">&amp;&amp;<\/span> apk del tzdata\r\n\r\n<span class=\"c\"># Copy php.ini<\/span>\r\n<span class=\"k\">COPY<\/span><span class=\"s\"> .\/etc\/php7\/php.ini \/etc\/php7\/<\/span>\r\n\r\n<span class=\"c\"># Copy httpd.conf<\/span>\r\n<span class=\"k\">COPY<\/span><span class=\"s\"> .\/etc\/apache2\/httpd.conf \/etc\/apache2\/<\/span>\r\n\r\n<span class=\"c\"># Composer Install<\/span>\r\n<span class=\"k\">RUN <\/span>curl <span class=\"nt\">-sS<\/span> https:\/\/getcomposer.org\/installer | php <span class=\"nt\">--<\/span> <span class=\"se\">\\\r\n<\/span>  <span class=\"nt\">--install-dir<\/span><span class=\"o\">=<\/span>\/usr\/local\/bin <span class=\"nt\">--filename<\/span><span class=\"o\">=<\/span>composer <span class=\"nt\">--version<\/span><span class=\"o\">=<\/span>1.10.6\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">&#8211;no-cache \u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066 :<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\/var\/cache\/apk\/ \u914d\u4e0b\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u81ea\u52d5\u3067\u6d88\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/ul>\n<p>\u5728\u8003\u8651\u53ef\u8bfb\u6027\u7684\u524d\u63d0\u4e0b\uff0c\u6211\u5c06\u4e0a\u8ff0\u5185\u5bb9\u603b\u7ed3\u5982\u4e0b\uff1a<br \/>\n\u5047\u5b9a\u8981\u8fdb\u884cgit\u514b\u9686\u7684\u5e94\u7528\u7a0b\u5e8f\u5c06\u88ab\u653e\u7f6e\u5728\/document\u4f5c\u4e3a\u6587\u6863\u6839\u76ee\u5f55\u3002<\/p>\n<p>\u9700\u8981\u4ed4\u7ec6\u5ba1\u67e5php.ini\u548chttpd.conf\u7684\u5185\u5bb9\uff0c\u5e76\u5c06\u5176\u653e\u7f6e\u5728Dockerfile\u76f8\u5bf9\u8def\u5f84\u4e2d\u3002\u6b64\u5916\uff0c\u4e3a\u4e86\u63d0\u9ad8\u53ef\u8bfb\u6027\u5e76\u4fdd\u6301\u4e00\u81f4\u6027\uff0c\u6211\u4eec\u51b3\u5b9a\u59cb\u7ec8\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684composer\u547d\u4ee4\uff0c\u5e76\u6307\u5b9a\u7248\u672c\u3002<\/p>\n<p>\u6211\u4f1a\u5728\u624b\u8fb9\u7684\u7535\u8111\u4e0a\u8fdb\u884c\u6784\u5efa\uff0c\u5e76\u786e\u8ba4\u5185\u5bb9\u3002<\/p>\n<pre class=\"post-pre\"><code>$ docker build -t docker-image-base-laravel7x .\/\r\n$ docker images\r\nREPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE\r\ndocker-image-base-laravel7x   latest              b239a1771f04        7 seconds ago       177MB\r\n<\/code><\/pre>\n<p>\u5360\u7528\u5c0f\u4e8e 177MB \u7684\u5b58\u50a8\u7a7a\u95f4\uff01<\/p>\n<p>\u5728\u6211\u4e4b\u524d\u8d1f\u8d23\u7684\u9879\u76ee\u4e2d\uff0c\u7531\u4e8e\u6700\u521d\u7684\u5e94\u7528\u5f62\u8c61\uff08CI\u5f62\u8c61\uff09\u63a5\u8fd13GB\uff0c\u5bfc\u81f4\u5e94\u7528\u975e\u5e38\u6c89\u91cd\u3002\u968f\u540e\uff0c\u5728\u4fdd\u6301\u57fa\u672c\u7ed3\u6784\u4e0d\u53d8\u7684\u60c5\u51b5\u4e0b\uff0c\u5c1d\u8bd5\u8fdb\u884c\u8f7b\u91cf\u5316\u4f18\u5316\uff0c\u6210\u529f\u5730\u5c06\u5176\u51cf\u5c11\u5230\u5927\u7ea61.5GB\u4ee5\u4e0b\u3002<\/p>\n<p>\u7136\u800c\uff0c\u8fd9\u4ecd\u7136\u662f\u5bf9\u672c\u5730\u5f00\u53d1\u8fc7\u7a0b\u6709\u70b9\u91cd\u7684\u611f\u89c9\u3002<br \/>\n\u4f5c\u4e3a\u4e00\u4e2a\u9884\u671f\uff0c\u5982\u679cCI\u6620\u50cf\u5c0f\u4e8e1GB\uff0c\u90a3\u4e48\u6709\u5f88\u5927\u53ef\u80fd\u4f1a\u6709\u5404\u79cd\u6539\u5584\u3002<\/p>\n<p>\u4ece\u8fd9\u4e2a\u524d\u63d0\u6765\u770b\uff0c177MB\u662f\u4e00\u4e2a\u76f8\u5f53\u4e0d\u9519\u7684\u6570\u503c\u3002<\/p>\n<p>\u30b3\u30f3\u30c6\u30ca\u306b\u5165\u3063\u3066\u72b6\u6cc1\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ docker run -it -d b239a1771f04\r\n$ docker ps\r\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES\r\nd87924fc9320        b239a1771f04        \"docker-php-entrypoi\u2026\"   8 seconds ago       Up 6 seconds                            epic_mccarthy\r\n$ docker exec -it d87924fc9320 \/bin\/sh\r\n<\/code><\/pre>\n<p>\u6211\u5011\u5c07\u5728\u8ca8\u6ac3\u5167\u6aa2\u67e5\u8b8a\u66f4\u9ede\u3002<\/p>\n<pre class=\"post-pre\"><code>\/ # date\r\nSun Jun 21 19:02:24 JST 2020\r\n\/ # apk list | grep \"php\" | grep \"installed\"\r\nphp7-openssl-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-tokenizer-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-pdo_mysql-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-common-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-mysqlnd-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-fileinfo-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-mbstring-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-session-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-json-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-xml-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-apache2-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-ctype-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-bcmath-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-pdo-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\nphp7-mysqli-7.3.19-r0 x86_64 {php7} (PHP-3.01 BSD LGPL-2.0-or-later MIT Zend-2.0) [installed]\r\n\/ # which composer\r\n\/usr\/local\/bin\/composer\r\n\/ # composer -V\r\nComposer version 1.10.6 2020-05-06 10:28:10\r\n\/ # which npm\r\n\/usr\/bin\/npm\r\n\/ # npm -v\r\n6.14.4\r\n<\/code><\/pre>\n<p>\u5df2\u7ecf\u987a\u5229\u5e94\u7528\u3002<\/p>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u6211\u628a php7-session \u5305\u62ec\u5728\u5185\u3002\u5982\u679c\u4e0d\u5b89\u88c5\u8fd9\u4e2a\u5305\uff0c\u5c06\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u9519\u8bef\u65e5\u5fd7\uff0c\u65e0\u6cd5\u786e\u8ba4 Laravel \u73af\u5883\u4e2d\u7684\u670d\u52a1\u662f\u5426\u6b63\u5e38\u3002<\/p>\n<pre class=\"post-pre\"><code>[Fri Jun 26 19:30:49.089145 2020] [php7:error] [pid 240] [client 172.17.0.1:42184] PHP Fatal error:  Interface 'SessionHandlerInterface' not found in \/application\/testapp\/vendor\/laravel\/framework\/src\/Illuminate\/Session\/FileSessionHandler.php on line 10\r\n[Fri Jun 26 19:30:49.394184 2020] [php7:error] [pid 236] [client 172.17.0.1:42204] PHP Fatal error:  Interface 'SessionHandlerInterface' not found in \/application\/testapp\/vendor\/laravel\/framework\/src\/Illuminate\/Session\/FileSessionHandler.php on line 10\r\n<\/code><\/pre>\n<h1>\u8003\u8651\u5728PECL\u4e0a\u8fdb\u884c\u5b89\u88c5\u3002<\/h1>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u8003\u8651\u4e86\u4ee5\u4e0b\u5173\u4e8ememcached\u7684\u65b9\u6cd5\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"c\"># Install Memcached<\/span>\r\n<span class=\"k\">RUN <\/span>apk add <span class=\"nt\">--no-cache<\/span> autoconf <span class=\"se\">\\\r\n<\/span>  libmemcached-dev zlib-dev <span class=\"se\">\\\r\n<\/span>  gcc g++ make <span class=\"se\">\\\r\n<\/span><span class=\"o\">&amp;&amp;<\/span> pecl <span class=\"nb\">install <\/span>memcached <span class=\"se\">\\\r\n<\/span><span class=\"o\">&amp;&amp;<\/span> docker-php-ext-enable memcached\r\n<\/code><\/pre>\n<p>\u4e4b\u524d\u6211\u63d0\u5230 docker-php-ext-install \u5728\u7ed3\u8bba\u4e0a\u662f\u65e0\u6cd5\u4f7f\u7528\u7684\uff0c\u539f\u56e0\u662f\u5b83\u65e0\u6cd5\u5c06\u6269\u5c55\u96c6\u6210\u5230\u6e90\u4ee3\u7801\u5b89\u88c5\u7684PHP\u4e2d\u3002<\/p>\n<p>apk \u3092\u4f7f\u3046\u3053\u3068\u3067\u3053\u306e\u90e8\u5206\u3092\u3088\u304d\u306b\u8a08\u3089\u3063\u3066\u304f\u308c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306aini\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u308b\u306e\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>\/ # ls -la \/etc\/php7\/conf.d\/\r\ntotal 72\r\ndrwxr-xr-x    1 root     root          4096 Jul  4 09:48 .\r\ndrwxr-xr-x    1 root     root          4096 Jul  3 10:49 ..\r\n-rw-r--r--    1 root     root            20 Jun 12 21:27 00_bcmath.ini\r\n-rw-r--r--    1 root     root            19 Jun 12 21:27 00_ctype.ini\r\n-rw-r--r--    1 root     root            22 Jun 12 21:27 00_fileinfo.ini\r\n-rw-r--r--    1 root     root            18 Jun 12 21:27 00_json.ini\r\n-rw-r--r--    1 root     root            22 Jun 12 21:27 00_mbstring.ini\r\n-rw-r--r--    1 root     root            21 Jun 12 21:27 00_openssl.ini\r\n-rw-r--r--    1 root     root            17 Jun 12 21:27 00_pdo.ini\r\n-rw-r--r--    1 root     root            21 Jun 12 21:27 00_session.ini\r\n-rw-r--r--    1 root     root            23 Jun 12 21:27 00_tokenizer.ini\r\n-rw-r--r--    1 root     root            17 Jun 12 21:27 00_xml.ini\r\n-rw-r--r--    1 root     root            21 Jun 12 21:27 01_mysqlnd.ini\r\n-rw-r--r--    1 root     root            20 Jun 12 21:27 02_mysqli.ini\r\n-rw-r--r--    1 root     root            23 Jun 12 21:27 02_pdo_mysql.ini\r\n-rw-r--r--    1 root     root            22 Jan 23 02:29 10_igbinary.ini\r\n<\/code><\/pre>\n<p>\u5b9f\u969b\u306b\u306f pecl \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u6301\u3064\u3082\u306e\u3082 apk \u3092\u7d4c\u7531\u3057\u3066\u304a\u3088\u305d\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u53ef\u80fd\u3068\u898b\u3048\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>\/ # apk search pecl\r\nphp7-pecl-imagick-dev-3.4.4-r3\r\nphp7-pecl-mailparse-3.1.0-r0\r\nphp7-pecl-imagick-3.4.4-r3\r\nphp7-pecl-uploadprogress-doc-1.1.3-r1\r\nphp7-pecl-amqp-1.10.2-r0\r\nphp7-pecl-yaml-2.1.0-r1\r\nphp7-pecl-memcache-4.0.5.2-r0\r\nphp7-pecl-psr-1.0.0-r0\r\nphp7-pecl-redis-5.2.2-r1\r\nphp7-pecl-ast-1.0.6-r0\r\nphp7-pecl-xdebug-2.9.6-r0\r\nphp7-pecl-couchbase-2.6.2-r0\r\nphp7-pecl-uploadprogress-1.1.3-r1\r\nphp7-pecl-apcu-5.1.18-r0\r\nphp7-pecl-timezonedb-2020.1-r0\r\nphp7-pecl-igbinary-3.1.2-r0\r\nphp7-pecl-uuid-1.1.0-r1\r\nphp7-pecl-gmagick-2.0.5_rc1-r5\r\nphp7-pecl-lzf-1.6.8-r0\r\nphp7-pecl-msgpack-2.1.0-r0\r\nphp7-pecl-vips-1.0.10-r1\r\nphp7-pecl-zmq-1.1.3-r6\r\nphp7-pear-7.3.19-r0\r\nphp7-pecl-mcrypt-1.0.3-r0\r\nphp7-pecl-xhprof-2.2.0-r0\r\nphp7-pecl-oauth-2.0.5-r0\r\nphp7-pecl-ssh2-1.2-r0\r\nphp7-pecl-memcached-3.1.5-r0\r\ntesseract-ocr-4.1.1-r3\r\nphp7-pecl-protobuf-3.12.2-r0\r\nphp7-pecl-event-2.5.6-r0\r\nphp7-pecl-xhprof-assets-2.2.0-r0\r\n<\/code><\/pre>\n<p>\u7dcf\u5408\u7684\u306b\u8003\u3048\u308b\u3068 apk \u306b\u5bc4\u305b\u3066\u3057\u307e\u3044\u3001 docker-php-ext-install\/enable \u7cfb\u306e\u30b3\u30de\u30f3\u30c9\u306f\u4f7f\u308f\u306a\u304f\u3066\u3082\u826f\u3044\u3068\u5224\u65ad\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u7531\u4e8eredis\uff08phpredis\uff09 \u7684\u5e7f\u6cdb\u5e94\u7528\uff0c\u6211\u6307\u5b9a\u4e86\u4e00\u4e2a\u5305\u542b\u4e86\u5b83\u4eec\u4ee5\u53camemcached\u7684Dockerfile\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"k\">FROM<\/span><span class=\"s\"> php:7.3-alpine3.12<\/span>\r\n\r\n<span class=\"c\"># Document Root<\/span>\r\n<span class=\"k\">RUN <\/span><span class=\"nb\">mkdir<\/span> \/application\r\n\r\n<span class=\"c\"># Package Install<\/span>\r\n<span class=\"k\">RUN <\/span>apk update <span class=\"o\">&amp;&amp;<\/span> apk add <span class=\"nt\">--no-cache<\/span> git tzdata apache2 npm <span class=\"se\">\\\r\n<\/span>    php7-common php7-apache2 php7-bcmath php7-ctype  php7-fileinfo php7-json <span class=\"se\">\\\r\n<\/span>    php7-mbstring php7-openssl php7-pdo php7-mbstring php7-tokenizer php7-xml <span class=\"se\">\\\r\n<\/span>    php7-session php7-pdo_mysql php7-mysqli <span class=\"se\">\\\r\n<\/span>    php7-pecl-memcached php7-pecl-memcache php7-pecl-redis <span class=\"se\">\\\r\n<\/span>  <span class=\"o\">&amp;&amp;<\/span> <span class=\"nb\">cp<\/span> \/usr\/share\/zoneinfo\/Asia\/Tokyo \/etc\/localtime <span class=\"se\">\\\r\n<\/span>  <span class=\"o\">&amp;&amp;<\/span> apk del tzdata\r\n\r\n<span class=\"c\"># Copy php.ini<\/span>\r\n<span class=\"k\">COPY<\/span><span class=\"s\"> .\/etc\/php7\/php.ini \/etc\/php7\/<\/span>\r\n\r\n<span class=\"c\"># Copy httpd.conf<\/span>\r\n<span class=\"k\">COPY<\/span><span class=\"s\"> .\/etc\/apache2\/httpd.conf \/etc\/apache2\/<\/span>\r\n\r\n<span class=\"c\"># Composer Install<\/span>\r\n<span class=\"k\">RUN <\/span>curl <span class=\"nt\">-sS<\/span> https:\/\/getcomposer.org\/installer | php <span class=\"nt\">--<\/span> <span class=\"se\">\\\r\n<\/span>  <span class=\"nt\">--install-dir<\/span><span class=\"o\">=<\/span>\/usr\/local\/bin <span class=\"nt\">--filename<\/span><span class=\"o\">=<\/span>composer <span class=\"nt\">--version<\/span><span class=\"o\">=<\/span>1.10.6\r\n<\/code><\/pre>\n<p>\u6bcf\u4e2a\u547d\u4ee4\u90fd\u6709\u6240\u7701\u7565\uff0c\u4f46\u56fe\u7247\u5c3a\u5bf8\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>$ docker images\r\nREPOSITORY                                         TAG                 IMAGE ID            CREATED             SIZE\r\ndocker-image-base-laravel7x-cache                  latest              a928f55b49a6        40 seconds ago      180MB\r\n<\/code><\/pre>\n<p>180MB\u2026<br \/>\n\u5168\u304f\u306e\u3068\u3053\u308d\u3001\u5287\u7684\u306b\u8efd\u3044\u3067\u3059\u3002<br \/>\nDockerfile\u306f\u3053\u306e\u4f5c\u308a\u65b9\u304c\u6b63\u89e3\u306a\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u8003\u5bdf\u3057\u307e\u3059\u3002<\/p>\n<h2>\u3088\u308a\u9ad8\u901f\u306aWEB\u306e\u305f\u3081\u306b<\/h2>\n<p>\u4ee5\u524d\u306e\u62c5\u5f53\u6848\u4ef6\u3067\u306f\u3001\u30a4\u30e1\u30fc\u30b8\u306bPHP\u3092\u9ad8\u901f\u5316\u3059\u308b\u305f\u3081\u306e\u30a2\u30af\u30bb\u30e9\u30ec\u30fc\u30bf APCu, OPcache \u306a\u3069\u304c\u5165\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u3042\u305f\u308a\u3082\u6848\u4ef6\u306f\u7269\u7406\u30b5\u30fc\u30d0\u304b\u3089\u79fb\u690d\u3057\u305f\u69cb\u6210\u3067\u3042\u3063\u305f\u305f\u3081\u3001(\u5f53\u521d\u306b) \u307b\u3068\u3093\u3069\u305d\u306e\u307e\u307e\u5165\u308c\u305f\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u3046\u3057\u305f\u30c4\u30fc\u30eb\u304c\u30b3\u30f3\u30c6\u30ca\u306b\u3069\u306e\u7a0b\u5ea6\u306a\u3058\u3080\u304b\u306f\u3001\u3061\u3087\u3063\u3068\u6ce8\u610f\u30fb\u691c\u8a3c\u304c\u5fc5\u8981\u304b\u306a\u2026\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u7531\u4e8e\u6211\u4e0d\u6253\u7b97\u6df1\u5165\u63a2\u8ba8\u8fd9\u4e9b\u95ee\u9898\uff0c\u6240\u4ee5\u662f\u5426\u9700\u8981\u8fdb\u884c\u786e\u8ba4\u5c06\u53d6\u51b3\u4e8e\u73af\u5883\u548c\u8bed\u8a00\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u52a0\u5feb\u7f51\u7edc\u901f\u5ea6\u7684\u8bdd&#8230;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3088\u308a\u4e00\u822c\u7684\u306a\u30ad\u30e3\u30c3\u30b7\u30e5 (CDN, \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af, DB, redis\u306b\u5bc4\u305b\u308b\u2026 etc)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30dc\u30c8\u30eb\u30cd\u30c3\u30af\u3092\u898b\u3064\u3051\u3066\u5bfe\u5fdc (\u30e2\u30c7\u30eb\/SQL\u307e\u308f\u308a, \u51e6\u7406\u30ed\u30b8\u30c3\u30af\u2026 etc)<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u3084\u30b5\u30fc\u30d0\u30ad\u30e3\u30d1\u30b7\u30c6\u30a3\u30d7\u30e9\u30f3\u30cb\u30f3\u30b0\u306e\u554f\u984c (\u30a4\u30f3\u30d5\u30e9\u7cfb)<\/ul>\n<p>\u306a\u3069\u306e\u30bb\u30aa\u30ea\u30fc\u304c\u3042\u308b\u306e\u3067\u3001\u307e\u305a\u5185\u90e8\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u30c4\u30fc\u30eb\u3092\u5c0e\u5165\u3059\u308b\u3088\u308a\u3001\u500b\u4eba\u7684\u306b\u306f\u5148\u306b\u305d\u3046\u3044\u3063\u305f\u539f\u56e0\u8abf\u67fb\u304b\u3089\u884c\u3046\u65b9\u304c\u3044\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u306a\u2026\u3068\u3002\u3002<br \/>\n\u8abf\u67fb\u306e\u904e\u7a0b\u3067\u6709\u7528\u6027\u304c\u8a8d\u3081\u3089\u308c\u308c\u3070\u3042\u308b\u3044\u306f\u3001\u3068\u3044\u3046\u306e\u304c\u672c\u6765\u306e\u9806\u5e8f\u3068\u8003\u3048\u307e\u3059\u3002<\/p>\n<p>PHP\u306b\u95a2\u3057\u3066\u306f\u8a00\u8a9e\u81ea\u4f53\u4ee5\u524d\u3088\u308a\u306f\u308b\u304b\u306b\u9ad8\u901f\u5316\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u8a00\u8a9e\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u5982\u4f55\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u3082\u7740\u76ee\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<h1>\u6700\u540e<\/h1>\n<p>Docker\u306f\u691c\u8a3c\u3084\u958b\u767a\u306e\u74b0\u5883\u4f5c\u308a\u306b\u3068\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002<br \/>\n\u307e\u305f\u3001Kubernetes\u306a\u3069\u3067\u3053\u308c\u3092\u904b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5b89\u5b9a\u3057\u305f\u672c\u756a\u74b0\u5883\u3092\u5f97\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u672c\u756a\u74b0\u5883\u306f\u3068\u306b\u304b\u304f\u8efd\u304f\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u904b\u7528\u5e74\u6570\u304c\u9577\u304f\u306a\u3063\u3066\u304d\u305f\u6642\u306b\u3001\u5192\u982d\u306b\u66f8\u3044\u305f\u3088\u3046\u306a\u3055\u307e\u3056\u307e\u306a\u4e0d\u5229\u76ca\u3092\u88ab\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002\u3055\u3089\u306b\u60aa\u3044\u3053\u3068\u306b\u3001Dockerfile\u306f\u30b3\u30fc\u30c9\u3067\u3042\u308b\u305f\u3081\u306b\u30b5\u30fc\u30d3\u30b9\u30a4\u30f3\u5f8c\u306b\u3053\u308c\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u306f (\u7279\u306b\u8abf\u6574\u9762\u3067\u2026) \u624b\u6570\u3082\u591a\u304f\u3001\u5f53\u7136\u5371\u967a\u3082\u4f34\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b3\u30f3\u30c6\u30ca\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30b5\u30fc\u30d3\u30b9\u30a4\u30f3\u6642\u306b\u306f\u3001<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u3088\u308a\u8efd\u304f\u30b7\u30f3\u30d7\u30eb\u306aDockerfile\u306e\u691c\u8a0e<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u6a5f\u80fd\u30c6\u30b9\u30c8\u3092\u7db2\u7f85\u7684\u306b\u884c\u3046\u3053\u3068<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30ad\u30e3\u30d1\u30b7\u30c6\u30a3\u30d7\u30e9\u30f3\u30cb\u30f3\u30b0\u3068\u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3\u306e\u8abf\u6574<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u73fe\u5b9f\u7684\u306a\u30b7\u30ca\u30ea\u30aa\u3092\u60f3\u5b9a\u3057\u305f\u8ca0\u8377\u8a66\u9a13<\/ul>\n<p>\u8fdb\u884c\u9002\u5f53\u5e73\u8861\u7684\u540c\u65f6\uff0c\u7ecf\u8fc7\u4e00\u5b9a\u7684\u65f6\u95f4\u4ed4\u7ec6\u5730\u6267\u884c\u4f1a\u66f4\u660e\u667a\u3002<\/p>\n<p>\u7cbe\u7075 \u2764\ufe0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u5728\u6211\u4e4b\u524d\u53c2\u4e0e\u7684\u9879\u76ee\u4e2d\uff0c\u4f7f\u7528Docker\u955c\u50cf\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u59cb\u7ec8\u5b58\u5728\u91cd\u91cf\u8fc7\u5927\u7684\u95ee\u9898\u3002 Docker\u30a4\u30e1\u30fc\u30b8\u304c [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-34744","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306adockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u5728\u6211\u4e4b\u524d\u53c2\u4e0e\u7684\u9879\u76ee\u4e2d\uff0c\u4f7f\u7528Docker\u955c\u50cf\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u59cb\u7ec8\u5b58\u5728\u91cd\u91cf\u8fc7\u5927\u7684\u95ee\u9898\u3002 Docker\u30a4\u30e1\u30fc\u30b8\u304c [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306adockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-01T07:32:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T15:01:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1f1637434c4406c18c3d\/110-0.png\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/\",\"name\":\"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-01-01T07:32:17+00:00\",\"dateModified\":\"2024-04-29T15:01:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306adockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf\/","og_locale":"zh_CN","og_type":"article","og_title":"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf","og_description":"\u9996\u5148 \u5728\u6211\u4e4b\u524d\u53c2\u4e0e\u7684\u9879\u76ee\u4e2d\uff0c\u4f7f\u7528Docker\u955c\u50cf\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u59cb\u7ec8\u5b58\u5728\u91cd\u91cf\u8fc7\u5927\u7684\u95ee\u9898\u3002 Docker\u30a4\u30e1\u30fc\u30b8\u304c [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306adockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-01-01T07:32:17+00:00","article_modified_time":"2024-04-29T15:01:40+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1f1637434c4406c18c3d\/110-0.png"}],"author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/","name":"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-01-01T07:32:17+00:00","dateModified":"2024-04-29T15:01:40+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u672c\u756a\u904b\u7528\u306e\u305f\u3081\u306e\u7406\u60f3\u7684\u306aDockerfile\u306b\u3064\u3044\u3066\u306e\u8003\u5bdf"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e6%9c%ac%e7%95%aa%e9%81%8b%e7%94%a8%e3%81%ae%e3%81%9f%e3%82%81%e3%81%ae%e7%90%86%e6%83%b3%e7%9a%84%e3%81%aadockerfile%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e8%80%83%e5%af%9f\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=34744"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34744\/revisions"}],"predecessor-version":[{"id":88170,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/34744\/revisions\/88170"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=34744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=34744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=34744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}