{"id":976,"date":"2026-05-11T07:34:05","date_gmt":"2026-05-11T07:34:05","guid":{"rendered":"https:\/\/opshub.com.cn\/?p=976"},"modified":"2026-05-11T07:35:20","modified_gmt":"2026-05-11T07:35:20","slug":"debian-12-jdk17-%e4%b8%ad%e6%96%87%e5%ad%97%e4%bd%93-%e5%8d%97%e4%ba%ac%e5%a4%a7%e5%ad%a6-apt-%e6%ba%90","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=976","title":{"rendered":"Debian 12 + JDK17 + \u4e2d\u6587\u5b57\u4f53 + \u5357\u4eac\u5927\u5b66 apt \u6e90"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># Debian 12 + JDK17 + \u4e2d\u6587\u5b57\u4f53 + \u5357\u4eac\u5927\u5b66 apt \u6e90\nFROM debian:12-slim\n\n# \u8ba9 apt-get install \u5728 Docker \u6784\u5efa\u8fc7\u7a0b\u4e2d\u4e0d\u8981\u8fdb\u5165\u4ea4\u4e92\u754c\u9762\nENV DEBIAN_FRONTEND=noninteractive\n\n# \u66ff\u6362 apt \u6e90\u4e3a\u5357\u4eac\u5927\u5b66\u955c\u50cf\nRUN sed -i 's@deb.debian.org@mirrors.nju.edu.cn@g' \/etc\/apt\/sources.list.d\/debian.sources\n\n# \u5b89\u88c5\u4e2d\u6587\u73af\u5883\u4e0e\u5b57\u4f53\nRUN apt-get update &amp;&amp; apt-get install -y \\\n    locales \\\n    tzdata \\\n    fontconfig \\\n    fonts-dejavu \\\n    fonts-noto-cjk \\\n    fonts-wqy-zenhei \\\n    fonts-wqy-microhei \\\n    ca-certificates \\\n    wget \\\n    &amp;&amp; sed -i '\/zh_CN.UTF-8\/s\/^# \/\/g' \/etc\/locale.gen \\\n    &amp;&amp; locale-gen \\\n    &amp;&amp; update-locale LANG=zh_CN.UTF-8 \\\n    &amp;&amp; fc-cache -fv \\\n    &amp;&amp; apt-get clean \\\n    &amp;&amp; rm -rf \/var\/lib\/apt\/lists\/*\n\n# locale \u751f\u6210\u5b8c\u6210\u540e\u518d\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\nENV LANG=zh_CN.UTF-8\nENV LANGUAGE=zh_CN:zh\nENV LC_ALL=zh_CN.UTF-8\n\n# JDK\nENV JAVA_HOME=\/opt\/jdk\nENV PATH=$JAVA_HOME\/bin:$PATH\n\n# \u521b\u5efa\u76ee\u5f55\nRUN mkdir -p \/opt\n\n# \u590d\u5236 JDK \u5b89\u88c5\u5305\nCOPY jdk-17.0.18_linux-x64_bin.tar.gz \/tmp\/\n\n# \u89e3\u538b JDK\nRUN tar -xzf \/tmp\/jdk-17.0.18_linux-x64_bin.tar.gz -C \/opt \\\n    &amp;&amp; mv \/opt\/jdk-17.0.18 \/opt\/jdk \\\n    &amp;&amp; rm -f \/tmp\/jdk-17.0.18_linux-x64_bin.tar.gz\n\n# \u9a8c\u8bc1\nRUN java -version\n\nCMD &#91;\"java\", \"-version\"]<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-976","post","type-post","status-publish","format-standard","hentry","category-dockerkubernetes"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=976"}],"version-history":[{"count":1,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/976\/revisions"}],"predecessor-version":[{"id":978,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/976\/revisions\/978"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}