{"id":326079,"date":"2021-07-07T09:00:29","date_gmt":"2021-07-07T09:00:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=326079"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=326079","title":{"rendered":"\u0418\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 .dockerignore"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u041f\u0440\u0438\u0448\u0435\u043b \u043a\u043e \u043c\u043d\u0435 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u043b: &quot;\u041a\u0430\u043a \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>.dockerignore<\/code> \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 docker-\u043e\u0431\u0440\u0430\u0437\u0430?&quot;<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0421\u043e\u0431\u0440\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xn\/qe\/tb\/xnqetbnljutem1f4mni5kruqvf4.png\" alt=\"\u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\"><br \/>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e \u0444\u0430\u0439\u043b\u0430\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>Dockerfile<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">FROM alpine COPY . . ENTRYPOINT cat data.txt<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>.dockerignore<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">data.txt README.md<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>data.txt (\u0444\u0430\u0439\u043b \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435)<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">hello habr<\/code><\/pre>\n<p>  <\/li>\n<li>\n<p>Dockerfile.dev<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">FROM alpine COPY . . ENTRYPOINT cat data.txt<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c \u043e\u043d \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e Dockerfile, \u043d\u043e \u0442\u0443\u0442 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430<\/p>\n<p>  <\/li>\n<li>\n<p>Dockerfile.dev.dockerignore (\u0444\u0430\u0439\u043b \u0438\u0433\u043d\u043e\u0440\u0430 \u0434\u043b\u044f \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 dev \u0441\u0431\u043e\u0440\u043a\u0438)<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">README.md<\/code><\/pre>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 Dockerfile, \u0441 \u0440\u0430\u0437\u043d\u0438\u0446\u0435\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438, \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 .dockerignore, \u043d\u0443 \u0438 \u0447\u0442\u043e\u0431 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043d\u0430\u0434\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u043b\u0430\u0433 DOCKER_BUILDKIT=1.<\/p>\n<p>  <\/p>\n<p>\u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<p>  <\/p>\n<h2 id=\"alya-prod-sborka\">\u0430\u043b\u044f \u043f\u0440\u043e\u0434-\u0441\u0431\u043e\u0440\u043a\u0430<\/h2>\n<p>  <\/p>\n<pre><code class=\"plaintext\">docker build -t with_ignore -f Dockerfile .  docker run --rm with_ignore<\/code><\/pre>\n<p>  <\/p>\n<p>\u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u0443\u0432\u0438\u0434\u0438\u043c<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">cat: can't open 'data.txt': No such file or directory<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"test-sborka\">\u0442\u0435\u0441\u0442 \u0441\u0431\u043e\u0440\u043a\u0430<\/h2>\n<p>  <\/p>\n<pre><code class=\"plaintext\">docker build -t without_ignore -f Dockerfile.dev .  docker run --rm without_ignore<\/code><\/pre>\n<p>  <\/p>\n<p>in output <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">hello habr<\/code><\/pre>\n<p>  <\/p>\n<p>PROFIT.<br \/>  <a href=\"https:\/\/github.com\/eotrokov\/ignore-.dockerignore\" rel=\"nofollow noopener noreferrer\">github<\/a><\/p>\n<\/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\/post\/566498\/\"> https:\/\/habr.com\/ru\/post\/566498\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u041f\u0440\u0438\u0448\u0435\u043b \u043a\u043e \u043c\u043d\u0435 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u0438 \u0441\u043f\u0440\u043e\u0441\u0438\u043b: &quot;\u041a\u0430\u043a \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>.dockerignore<\/code> \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 docker-\u043e\u0431\u0440\u0430\u0437\u0430?&quot;<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/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-326079","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/326079","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=326079"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/326079\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=326079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=326079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=326079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}