{"id":562,"date":"2023-09-12T18:14:57","date_gmt":"2023-09-12T10:14:57","guid":{"rendered":"http:\/\/madapapa.com\/wordpress\/?p=562"},"modified":"2023-09-12T19:00:39","modified_gmt":"2023-09-12T11:00:39","slug":"xin-ji-qi-an-zhuangdocker-hepython3","status":"publish","type":"post","link":"http:\/\/madapapa.com\/wordpress\/?p=562","title":{"rendered":"\u65b0\u673a\u5668\u5b89\u88c5docker\u548cpython3"},"content":{"rendered":"<h2><a id=\"%E5%AE%89%E8%A3%85docker\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5b89\u88c5docker<\/h2>\n<pre><code class=\"language-plain_text\">root@instance-20230906-1618:~# docker --version\nCommand 'docker' not found, but can be installed with:\nsnap install docker         # version 20.10.24, or\napt  install podman-docker  # version 3.4.4+ds1-1ubuntu1.22.04.2\napt  install docker.io      # version 24.0.5-0ubuntu1~22.04.1\nSee 'snap info docker' for additional versions.\n<\/code><\/pre>\n<p>\u670d\u52a1\u5668\u7684\u7248\u672c\u662f<\/p>\n<pre><code class=\"language-plain_text\">root@instance-20230906-1618:~# lsb_release -a\nNo LSB modules are available.\nDistributor ID: Ubuntu\nDescription:    Ubuntu 22.04.3 LTS\nRelease:        22.04\nCodename:       jammy\n<\/code><\/pre>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5c11\u4e86\u4e00\u70b9\u7a7a\u95f4<\/p>\n<pre><code class=\"language-plain_text\">267 MB of additional disk space will be used\n<\/code><\/pre>\n<h2><a id=\"%E5%AE%89%E8%A3%85python3%E7%9A%84container\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5b89\u88c5python3\u7684container<\/h2>\n<p>\u5176\u5b9e\u6211\u53ef\u4ee5\u4f7f\u7528python3\u7684\u865a\u62df\u673a\uff0c\u4f46\u662f\u56e0\u4e3a\u6700\u8fd1\u4f7f\u7528docker\u6bd4\u8f83\u987a\u624b\uff0c\u6240\u4ee5\u6253\u7b97\u5c1d\u8bd5\u4e0b<\/p>\n<ul>\n<li>\u5e0c\u671b\u5728\u8fd9\u4e2a\u5bb9\u5668\u91cc\uff0c\u5b89\u88c5\u4e0ellm\u6709\u5173\u7684\u63d2\u4ef6\u3001\u5411\u91cf\u6570\u636e\u5e93\u7b49\u7b49<\/li>\n<li>\u6216\u8005\u5728\u8fd9\u53f0\u673a\u5668\u4e0a\u5b89\u88c5\u5176\u4ed6\u7684\u5bb9\u5668\uff0c\u4f8b\u5982\u5173\u7cfb\u6570\u636e\u5e93\u3001\u5411\u91cf\u6570\u636e\u5e93\u6216\u8005\u5176\u4ed6\u7ec4\u4ef6\uff0c\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u5fae\u670d\u52a1\u4ef7\u683c\uff0c\u6700\u597d\u4e5f\u53ef\u4ee5\u7528k8s\u7ba1\u7406<\/li>\n<\/ul>\n<p>\u5b89\u88c5python\u6700\u65b0\u7248\u672c\uff0cpython:3<\/p>\n<pre><code class=\"language-plain_text\">docker pull python:3\n<\/code><\/pre>\n<p>\u542f\u52a8docker\uff0c\u800c\u4e14\u8fdb\u5165\u4ea4\u4e92\uff08i\uff09\u548c\u7ec8\u7aef\u6a21\u5f0f\uff08t\uff09\uff0c\u8fd9\u91cc\u6709\u4e2a\u5c0f\u95ee\u9898\uff0c\u542f\u52a8\u5bb9\u5668\u540e\u4f1a\u81ea\u52a8\u8fdb\u5165\u7ec8\u7aef\u6a21\u5f0f\uff0c\u6211\u4e0d\u662f\u5f88\u559c\u6b22\u8fd9\u6837\uff0c\u6240\u4ee5\u5e94\u8be5\u53bb\u6389t\u8fd9\u4e2a\u53c2\u6570<\/p>\n<pre><code class=\"language-plain_text\">docker run -it --name python3-container python:3\n<\/code><\/pre>\n<p>\u8fdb\u5165docker\uff0c\u4f7f\u7528terminal\u7f16\u5199\u6267\u884c\u811a\u672c,\u53ef\u4ee5\u770b\u5230\u5bb9\u5668\u91cc\u7684python\u548c\u5bbf\u4e3b\u673a\u7684python\uff0c\u7248\u672c\u662f\u4e0d\u4e00\u81f4\u7684\u3002<\/p>\n<pre><code class=\"language-plain_text\">root@instance-20230906-1618:~# docker exec -it python3-container \/bin\/bash\nroot@e6d7fd5c9e79:\/# python --version\nPython 3.11.5\nroot@e6d7fd5c9e79:\/# pip --version\npip 23.2.1 from \/usr\/local\/lib\/python3.11\/site-packages\/pip (python 3.11)\nroot@e6d7fd5c9e79:\/# exit\nexit\nroot@instance-20230906-1618:~# python3 --version\nPython 3.10.12\nroot@instance-20230906-1618:~# pip --version\nCommand 'pip' not found, but can be installed with:\napt install python3-pip\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5docker root@instance-20230906-1618:~# docker &#8211;version Command &#8216;docker&#8217; not found, but can be installed with: snap install docker # version 20.10.24, or apt install podman-docker # version 3.4.4+ds1-1ubuntu1.22.04.2 apt install docker.io # version 24.0.5-0ubuntu1~22.04.1 See &#8216;snap info docker&#8217; for additional versions. \u670d\u52a1\u5668\u7684\u7248\u672c\u662f root@instance-20230906-1618:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS &hellip; <a href=\"http:\/\/madapapa.com\/wordpress\/?p=562\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u65b0\u673a\u5668\u5b89\u88c5docker\u548cpython3<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[48,5],"tags":[],"class_list":["post-562","post","type-post","status-publish","format-standard","hentry","category-artificial-intelligence","category-linux"],"_links":{"self":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=562"}],"version-history":[{"count":2,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/562\/revisions"}],"predecessor-version":[{"id":566,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/562\/revisions\/566"}],"wp:attachment":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=562"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}