{"id":308971,"date":"2020-08-25T15:00:35","date_gmt":"2020-08-25T15:00:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=308971"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=308971","title":{"rendered":"\u0420\u0430\u0437\u0431\u043e\u0440 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e Docker-\u043e\u0431\u0440\u0430\u0437\u0430 Python"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516310\/\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Docker-\u043e\u0431\u0440\u0430\u0437 Python \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0435\u043d. \u041a\u0441\u0442\u0430\u0442\u0438, \u044f \u0438 \u0441\u0430\u043c <a href=\"https:\/\/pythonspeed.com\/articles\/base-image-python-docker-images\/\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b<\/a> \u043e\u0434\u043d\u0443 \u0438\u0437 \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u041d\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0410 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u0435 \u0438 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516310\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gq\/ku\/om\/gqkuom2gzptu11hsvbnxpzos-vq.png\"><\/a><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u043d \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0437, \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0443\u044e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u0443, \u043e \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043e \u0435\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u0442\u0443\u0442 \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 <code>python:3.8-slim-buster<\/code> (\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u043e\u043c Dockerfile \u043e\u0442 <a href=\"https:\/\/github.com\/docker-library\/python\/blob\/1b78ff417e41b6448d98d6dd6890a1f95b0ce4be\/3.8\/buster\/slim\/Dockerfile\">19 \u0430\u0432\u0433\u0443\u0441\u0442\u0430 2020 \u0433\u043e\u0434\u0430<\/a>) \u0438 \u043f\u043e \u0445\u043e\u0434\u0443 \u0434\u0435\u043b\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043d\u0430 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u044f\u0445.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0427\u0438\u0442\u0430\u0435\u043c \u0444\u0430\u0439\u043b Dockerfile<\/font><\/h2>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437<\/font><\/h3>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430:<\/p>\n<pre><code class=\"python\">FROM debian:buster-slim <\/code><\/pre>\n<p>  \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043b\u044f <code>python:3.8-slim-buster<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Debian GNU\/Linux 10 \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 Debian, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0435\u0449\u0451 \u043a\u0430\u043a Buster (\u0440\u0435\u043b\u0438\u0437\u044b Debian \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0438\u0437 \u00ab\u0418\u0441\u0442\u043e\u0440\u0438\u0438 \u0438\u0433\u0440\u0443\u0448\u0435\u043a\u00bb). <a href=\"https:\/\/toystorymovies.fandom.com\/wiki\/Buster\">\u0411\u0430\u0441\u0442\u0435\u0440<\/a> \u2014 \u044d\u0442\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0441\u043e\u0431\u0430\u043a\u0430 \u042d\u043d\u0434\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0441 \u043e\u0431\u0440\u0430\u0437 \u043b\u0435\u0436\u0438\u0442 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 Linux, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a. \u0412 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 <code>slim<\/code> \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0435\u043c \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435. \u0422\u0430\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b<\/font><\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b. \u041f\u0435\u0440\u0432\u0430\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>\/usr\/local\/bin<\/code> \u0432 <code>$PATH<\/code>.<\/p>\n<pre><code class=\"python\"># \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u0431\u043e\u0440 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 python, \u0430 \u043d\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430 ENV PATH \/usr\/local\/bin:$PATH <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0437 \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0442\u0430\u043a, \u0447\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Python \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 <code>\/usr\/local<\/code>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u2014 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044f\u0437\u044b\u043a\u0430:<\/p>\n<pre><code class=\"python\"># http:\/\/bugs.python.org\/issue19846 # &gt; \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 &quot;LANG=C&quot; \u0432 Linux *\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0438\u0437 \u0441\u0442\u0440\u043e\u044f Python 3*, \u0430 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e. ENV LANG C.UTF-8 <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 Python 3, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 UTF-8. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0438 \u0434\u043d\u0438 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u043c Dockerfile \u043d\u0443\u0436\u043d\u0430 \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Python:<\/p>\n<pre><code class=\"python\">ENV PYTHON_VERSION 3.8.5 <\/code><\/pre>\n<p>  \u0412 Dockerfile \u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0441 GPG-\u043a\u043b\u044e\u0447\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0434\u043b\u044f \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 Python.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/font><\/h3>\n<p>  Python, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b, \u043d\u0443\u0436\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<pre><code class=\"python\">RUN apt-get update &amp;&amp; apt-get install -y --no-install-recommends \\ \u00a0\u00a0\u00a0\u00a0ca-certificates \\ \u00a0\u00a0\u00a0\u00a0netbase \\ \u00a0\u00a0&amp;&amp; rm -rf \/var\/lib\/apt\/lists\/* <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, <code>ca-certificates<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0446\u0435\u043d\u0442\u0440\u043e\u0432 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u041d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 <a href=\"https:\/\/-%D0%B0%D0%B4%D1%80%D0%B5%D1%81%D0%BE%D0%B2\">-\u0430\u0434\u0440\u0435\u0441\u043e\u0432<\/a>. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 Python, <code>wget<\/code> \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u043a\u0435\u0442, <code>netbase<\/code>, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0432 <code>\/etc<\/code> \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0438\u043c\u0451\u043d \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>\/etc\/services<\/code> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0438\u043c\u0451\u043d \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0432\u0440\u043e\u0434\u0435 <code>https<\/code>, \u0441 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 \u043f\u043e\u0440\u0442\u043e\u0432. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <code>443\/tcp<\/code>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Python<\/font><\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430\u0431\u043e\u0440\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 Python, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0435\u0438\u043d\u0441\u0442\u0430\u043b\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b Debian:<\/p>\n<pre><code class=\"python\">RUN set -ex \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; savedAptMark=&quot;$(apt-mark showmanual)&quot; \\ \u00a0\u00a0&amp;&amp; apt-get update &amp;&amp; apt-get install -y --no-install-recommends \\ \u00a0\u00a0\u00a0\u00a0dpkg-dev \\ \u00a0\u00a0\u00a0\u00a0gcc \\ \u00a0\u00a0\u00a0\u00a0libbluetooth-dev \\ \u00a0\u00a0\u00a0\u00a0libbz2-dev \\ \u00a0\u00a0\u00a0\u00a0libc6-dev \\ \u00a0\u00a0\u00a0\u00a0libexpat1-dev \\ \u00a0\u00a0\u00a0\u00a0libffi-dev \\ \u00a0\u00a0\u00a0\u00a0libgdbm-dev \\ \u00a0\u00a0\u00a0\u00a0liblzma-dev \\ \u00a0\u00a0\u00a0\u00a0libncursesw5-dev \\ \u00a0\u00a0\u00a0\u00a0libreadline-dev \\ \u00a0\u00a0\u00a0\u00a0libsqlite3-dev \\ \u00a0\u00a0\u00a0\u00a0libssl-dev \\ \u00a0\u00a0\u00a0\u00a0make \\ \u00a0\u00a0\u00a0\u00a0tk-dev \\ \u00a0\u00a0\u00a0\u00a0uuid-dev \\ \u00a0\u00a0\u00a0\u00a0wget \\ \u00a0\u00a0\u00a0\u00a0xz-utils \\ \u00a0\u00a0\u00a0\u00a0zlib1g-dev \\ # \u0441 \u0440\u0435\u043b\u0438\u0437\u0430 Stretch &quot;gpg&quot; \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432 \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u00a0\u00a0\u00a0\u00a0$(command -v gpg &gt; \/dev\/null || echo 'gnupg dirmngr') \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; wget -O python.tar.xz &quot;https:\/\/www.python.org\/ftp\/python\/${PYTHON_VERSION%%[a-z]*}\/Python-$PYTHON_VERSION.tar.xz&quot; \\ \u00a0\u00a0&amp;&amp; wget -O python.tar.xz.asc &quot;https:\/\/www.python.org\/ftp\/python\/${PYTHON_VERSION%%[a-z]*}\/Python-$PYTHON_VERSION.tar.xz.asc&quot; \\ \u00a0\u00a0&amp;&amp; export GNUPGHOME=&quot;$(mktemp -d)&quot; \\ \u00a0\u00a0&amp;&amp; gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys &quot;$GPG_KEY&quot; \\ \u00a0\u00a0&amp;&amp; gpg --batch --verify python.tar.xz.asc python.tar.xz \\ \u00a0\u00a0&amp;&amp; { command -v gpgconf &gt; \/dev\/null &amp;&amp; gpgconf --kill all || :; } \\ \u00a0\u00a0&amp;&amp; rm -rf &quot;$GNUPGHOME&quot; python.tar.xz.asc \\ \u00a0\u00a0&amp;&amp; mkdir -p \/usr\/src\/python \\ \u00a0\u00a0&amp;&amp; tar -xJC \/usr\/src\/python --strip-components=1 -f python.tar.xz \\ \u00a0\u00a0&amp;&amp; rm python.tar.xz \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; cd \/usr\/src\/python \\ \u00a0\u00a0&amp;&amp; gnuArch=&quot;$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)&quot; \\ \u00a0\u00a0&amp;&amp; .\/configure \\ \u00a0\u00a0\u00a0\u00a0--build=&quot;$gnuArch&quot; \\ \u00a0\u00a0\u00a0\u00a0--enable-loadable-sqlite-extensions \\ \u00a0\u00a0\u00a0\u00a0--enable-optimizations \\ \u00a0\u00a0\u00a0\u00a0--enable-option-checking=fatal \\ \u00a0\u00a0\u00a0\u00a0--enable-shared \\ \u00a0\u00a0\u00a0\u00a0--with-system-expat \\ \u00a0\u00a0\u00a0\u00a0--with-system-ffi \\ \u00a0\u00a0\u00a0\u00a0--without-ensurepip \\ \u00a0\u00a0&amp;&amp; make -j &quot;$(nproc)&quot; \\ \u00a0\u00a0\u00a0\u00a0LDFLAGS=&quot;-Wl,--strip-all&quot; \\ \u00a0\u00a0&amp;&amp; make install \\ \u00a0\u00a0&amp;&amp; rm -rf \/usr\/src\/python \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; find \/usr\/local -depth \\ \u00a0\u00a0\u00a0\u00a0\\( \\ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\\( -type d -a \\( -name test -o -name tests -o -name idle_test \\) \\) \\ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-o \\( -type f -a \\( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \\) \\) \\ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-o \\( -type f -a -name 'wininst-*.exe' \\) \\ \u00a0\u00a0\u00a0\u00a0\\) -exec rm -rf '{}' + \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; ldconfig \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; apt-mark auto '.*' &gt; \/dev\/null \\ \u00a0\u00a0&amp;&amp; apt-mark manual $savedAptMark \\ \u00a0\u00a0&amp;&amp; find \/usr\/local -type f -executable -not \\( -name '*tkinter*' \\) -exec ldd '{}' ';' \\ \u00a0\u00a0\u00a0\u00a0| awk '\/=&gt;\/ { print $(NF-1) }' \\ \u00a0\u00a0\u00a0\u00a0| sort -u \\ \u00a0\u00a0\u00a0\u00a0| xargs -r dpkg-query --search \\ \u00a0\u00a0\u00a0\u00a0| cut -d: -f1 \\ \u00a0\u00a0\u00a0\u00a0| sort -u \\ \u00a0\u00a0\u00a0\u00a0| xargs -r apt-mark manual \\ \u00a0\u00a0&amp;&amp; apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \\ \u00a0\u00a0&amp;&amp; rm -rf \/var\/lib\/apt\/lists\/* \\ \u00a0\u00a0\\ \u00a0\u00a0&amp;&amp; python3 --version <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e, \u043d\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u2014 \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>Python \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <code>\/usr\/local<\/code>.<\/li>\n<li>\u0423\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 .pyc-\u0444\u0430\u0439\u043b\u044b.<\/li>\n<li>\u041f\u0430\u043a\u0435\u0442\u044b, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u2014 <code>gcc<\/code> \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 Python, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043d\u0438\u0445 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442.<\/li>\n<\/ol>\n<p>  \u0418\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 <code>RUN<\/code>, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0441\u043b\u043e\u0451\u0432, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0437\u0430.<\/p>\n<p>  \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e Python \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0443\u0436\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>libbluetooth-dev<\/code>. \u041c\u043d\u0435 \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, Python \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c Bluetooth-\u0441\u043e\u043a\u0435\u0442\u044b, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a<\/font><\/h3>\n<p>  \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u0440\u0430\u0431\u043e\u0442\u044b <code>\/usr\/local\/bin\/python3<\/code> \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 <code>\/usr\/local\/bin\/python<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c Python \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<pre><code class=\"python\"># \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a, \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 RUN cd \/usr\/local\/bin \\ \u00a0\u00a0&amp;&amp; ln -s idle3 idle \\ \u00a0\u00a0&amp;&amp; ln -s pydoc3 pydoc \\ \u00a0\u00a0&amp;&amp; ln -s python3 python \\ \u00a0\u00a0&amp;&amp; ln -s python3-config python-config <\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 pip<\/font><\/h3>\n<p>  \u0423 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 <code>pip<\/code> \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u0432\u044b\u0445\u043e\u0434\u0430 \u0440\u0435\u043b\u0438\u0437\u043e\u0432, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043e\u0442 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0440\u0435\u043b\u0438\u0437\u043e\u0432 Python. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u044d\u0442\u043e\u043c Dockerfile \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 Python 3.8.5, \u0432\u044b\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0438\u044e\u043b\u0435 2020. \u0410 pip 20.2.2 \u0432\u044b\u0448\u0435\u043b \u0432 \u0430\u0432\u0433\u0443\u0441\u0442\u0435, \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 Python, \u043d\u043e Dockerfile \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0441\u0432\u0435\u0436\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f <code>pip<\/code>:<\/p>\n<pre><code class=\"python\"># \u0435\u0441\u043b\u0438 \u044d\u0442\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u0437\u0432\u0430\u0442\u044c &quot;PIP_VERSION&quot;, \u0442\u043e pip \u0432\u044b\u0434\u0430\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443: &quot;ValueError: invalid truth value '&lt;VERSION&gt;'&quot; ENV PYTHON_PIP_VERSION 20.2.2 # https:\/\/github.com\/pypa\/get-pip ENV PYTHON_GET_PIP_URL https:\/\/github.com\/pypa\/get-pip\/raw\/5578af97f8b2b466f4cdbebe18a3ba2d48ad1434\/get-pip.py ENV PYTHON_GET_PIP_SHA256 d4d62a0850fe0c2e6325b2cc20d818c580563de5a2038f917e3cb0e25280b4d1  RUN set -ex; \\ \u00a0\u00a0\\ \u00a0\u00a0savedAptMark=&quot;$(apt-mark showmanual)&quot;; \\ \u00a0\u00a0apt-get update; \\ \u00a0\u00a0apt-get install -y --no-install-recommends wget; \\ \u00a0\u00a0\\ \u00a0\u00a0wget -O get-pip.py &quot;$PYTHON_GET_PIP_URL&quot;; \\ \u00a0\u00a0echo &quot;$PYTHON_GET_PIP_SHA256 *get-pip.py&quot; | sha256sum --check --strict -; \\ \u00a0\u00a0\\ \u00a0\u00a0apt-mark auto '.*' &gt; \/dev\/null; \\ \u00a0\u00a0[ -z &quot;$savedAptMark&quot; ] || apt-mark manual $savedAptMark; \\ \u00a0\u00a0apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \\ \u00a0\u00a0rm -rf \/var\/lib\/apt\/lists\/*; \\ \u00a0\u00a0\\ \u00a0\u00a0python get-pip.py \\ \u00a0\u00a0\u00a0\u00a0--disable-pip-version-check \\ \u00a0\u00a0\u00a0\u00a0--no-cache-dir \\ \u00a0\u00a0\u00a0\u00a0&quot;pip==$PYTHON_PIP_VERSION&quot; \\ \u00a0\u00a0; \\ \u00a0\u00a0pip --version; \\ \u00a0\u00a0\\ \u00a0\u00a0find \/usr\/local -depth \\ \u00a0\u00a0\u00a0\u00a0\\( \\ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\\( -type d -a \\( -name test -o -name tests -o -name idle_test \\) \\) \\ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0-o \\ \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\\( -type f -a \\( -name '*.pyc' -o -name '*.pyo' \\) \\) \\ \u00a0\u00a0\u00a0\u00a0\\) -exec rm -rf '{}' +; \\ \u00a0\u00a0rm -f get-pip.py <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u0438 \u043f\u0440\u0435\u0436\u0434\u0435, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 .pyc-\u0444\u0430\u0439\u043b\u044b.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043e\u0431\u0440\u0430\u0437<\/font><\/h3>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432 Dockerfile \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043e\u0431\u0440\u0430\u0437:<\/p>\n<pre><code class=\"python\">CMD [&quot;python3&quot;] <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>CMD<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>ENTRYPOINT<\/code> \u043c\u044b, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u043e\u0431\u0440\u0430\u0437, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a python:<\/p>\n<pre><code class=\"python\">$ docker run -it python:3.8-slim-buster Python 3.8.5 (default, Aug\u00a0 4 2020, 16:24:08) [GCC 8.3.0] on linux Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information. &gt;&gt;&gt; <\/code><\/pre>\n<p>  \u041d\u043e, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<pre><code class=\"python\">$ docker run -it python:3.8-slim-buster bash root@280c9b73e8f9:\/# <\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0442\u043e\u0433\u0438<\/font><\/h2>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0432 Dockerfile \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e Python-\u043e\u0431\u0440\u0430\u0437\u0430 <code>slim-buster<\/code>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0412 \u0441\u043e\u0441\u0442\u0430\u0432 \u043e\u0431\u0440\u0430\u0437\u0430 \u0432\u0445\u043e\u0434\u0438\u0442 Python<\/font><\/h3>\n<p>  \u0425\u043e\u0442\u044f \u044d\u0442\u043e \u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c, \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e Python \u0432\u043a\u043b\u044e\u0447\u0451\u043d \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u043e\u0431\u0440\u0430\u0437\u0430. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u044d\u0442\u043e \u043f\u0443\u0442\u0451\u043c \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 <code>\/usr\/local<\/code>.<\/p>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0437, \u043f\u043e\u0440\u043e\u0439 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u044e\u0442 \u043e\u0434\u043d\u0443 \u0438 \u0442\u0443 \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 Debian-\u0432\u0435\u0440\u0441\u0438\u0438 Python:<\/p>\n<pre><code class=\"python\">FROM python:3.8-slim-buster  # \u0414\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e: RUN apt-get update &amp;&amp; apt-get install python3-dev <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>RUN<\/code> Python \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0435\u0449\u0451 \u0440\u0430\u0437, \u043d\u043e \u0432 <code>\/usr<\/code>, \u0430 \u043d\u0435 \u0432 <code>\/usr\/local<\/code>. \u0418 \u044d\u0442\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430 \u0432\u0435\u0440\u0441\u0438\u044f Python, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0432 <code>\/usr\/local<\/code>. \u0410 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u043c Docker-\u0444\u0430\u0439\u043b\u043e\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, <a href=\"https:\/\/pythonspeed.com\/articles\/importerror-docker\/\">\u043d\u0435 \u043d\u0443\u0436\u043d\u044b<\/a> \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 Python \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u0435. \u042d\u0442\u043e, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b.<\/p>\n<p>  \u0410 \u0435\u0441\u043b\u0438 \u0436\u0435 \u043a\u043e\u043c\u0443-\u0442\u043e \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043d\u0443\u0436\u043d\u0430 Debian-\u0432\u0435\u0440\u0441\u0438\u044f Python, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 <code>debian:buster-slim<\/code>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0412 \u043e\u0431\u0440\u0430\u0437 \u0432\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u0430\u044f \u0441\u0432\u0435\u0436\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f pip<\/font><\/h3>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0430\u043c\u044b\u0439 \u0441\u0432\u0435\u0436\u0438\u0439 \u0440\u0435\u043b\u0438\u0437 Python 3.5 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f \u0432 \u043d\u043e\u044f\u0431\u0440\u0435 2019, \u043d\u043e Docker-\u043e\u0431\u0440\u0430\u0437 <code>python:3.5-slim-buster<\/code> \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f <code>pip<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0448\u0435\u043b \u0432 \u0430\u0432\u0433\u0443\u0441\u0442\u0435 2020. \u042d\u0442\u043e (\u043e\u0431\u044b\u0447\u043d\u043e) \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u0435 \u0441\u0432\u0435\u0436\u0438\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0431\u043e\u043b\u0435\u0435 \u043d\u043e\u0432\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u00ab\u043a\u043e\u043b\u0451\u0441\u00bb.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u0418\u0437 \u043e\u0431\u0440\u0430\u0437\u0430 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 .pyc-\u0444\u0430\u0439\u043b\u044b<\/font><\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 .pyc. \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f <a href=\"https:\/\/docs.python.org\/3\/library\/compileall.html\">compileall<\/a>.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d\u041e\u0431\u0440\u0430\u0437 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 Debian<\/font><\/h3>\n<p>  \u0425\u043e\u0442\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043e\u0431\u0440\u0430\u0437\u044b <code>debian:buster-slim<\/code> \u0438 <code>python<\/code> \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432\u044b\u0445\u043e\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 Debian \u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u0445 \u0432 \u043e\u0431\u0440\u0430\u0437\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0430 Linux.<\/p>\n<p>  <b>\u041a\u0430\u043a\u0438\u043c\u0438 Docker-\u043e\u0431\u0440\u0430\u0437\u0430\u043c\u0438 \u0432\u044b \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f Python-\u043a\u043e\u0434\u0430?<\/b><\/p>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=perevod&amp;utm_campaign=official-python-docker\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\"><\/a><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516310\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516310\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516310\/\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 Docker-\u043e\u0431\u0440\u0430\u0437 Python \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0435\u043d. \u041a\u0441\u0442\u0430\u0442\u0438, \u044f \u0438 \u0441\u0430\u043c <a href=\"https:\/\/pythonspeed.com\/articles\/base-image-python-docker-images\/\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b<\/a> \u043e\u0434\u043d\u0443 \u0438\u0437 \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u041d\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043d\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0410 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u0435 \u0438 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>  <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/516310\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/gq\/ku\/om\/gqkuom2gzptu11hsvbnxpzos-vq.png\"><\/a><\/p>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u043d \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0437, \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0443\u044e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u043f\u043e\u043b\u044c\u0437\u0443, \u043e \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043e \u0435\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u0445. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u044f \u0440\u0430\u0437\u0431\u0435\u0440\u0443 \u0442\u0443\u0442 \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 <code>python:3.8-slim-buster<\/code> (\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u043e\u043c Dockerfile \u043e\u0442 <a href=\"https:\/\/github.com\/docker-library\/python\/blob\/1b78ff417e41b6448d98d6dd6890a1f95b0ce4be\/3.8\/buster\/slim\/Dockerfile\">19 \u0430\u0432\u0433\u0443\u0441\u0442\u0430 2020 \u0433\u043e\u0434\u0430<\/a>) \u0438 \u043f\u043e \u0445\u043e\u0434\u0443 \u0434\u0435\u043b\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043d\u0430 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0434\u0435\u0442\u0430\u043b\u044f\u0445.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-308971","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=308971"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308971\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}