{"id":611,"date":"2026-09-29T12:00:00","date_gmt":"2026-09-29T12:00:00","guid":{"rendered":"https:\/\/konteynerium.com\/index.php\/2026\/09\/29\/docker-imaji-ve-container-farki-katmanlar-etiketler-yasam-dongusu\/"},"modified":"2026-09-29T12:00:00","modified_gmt":"2026-09-29T12:00:00","slug":"docker-imaji-ve-container-farki-katmanlar-etiketler-yasam-dongusu","status":"publish","type":"post","link":"https:\/\/konteynerium.com\/index.php\/2026\/09\/29\/docker-imaji-ve-container-farki-katmanlar-etiketler-yasam-dongusu\/","title":{"rendered":"Docker \u0130maj\u0131 ve Container Fark\u0131: Katmanlar, Etiketler ve Ya\u015fam D\u00f6ng\u00fcs\u00fc"},"content":{"rendered":"<p>&#8220;\u0130maj&#8221; ve &#8220;container&#8221; kelimeleri g\u00fcnl\u00fck konu\u015fmada s\u0131k s\u0131k birbirinin yerine kullan\u0131l\u0131r, ama asl\u0131nda farkl\u0131 \u015feylerdir. Bu fark\u0131 ba\u015ftan do\u011fru kavramak; <code>docker rm<\/code> ile <code>docker rmi<\/code> aras\u0131ndaki farktan, &#8220;neden imaj\u0131 sildim de yer a\u00e7\u0131lmad\u0131?&#8221; sorusuna kadar bir s\u00fcr\u00fc kafa kar\u0131\u015f\u0131kl\u0131\u011f\u0131n\u0131 \u00f6nler.<\/p>\n<h2>K\u0131sa cevap: tarif ve yemek<\/h2>\n<p>Programlamadan bir benzetme: <strong>imaj bir s\u0131n\u0131f (class) gibidir, container onun \u00e7al\u0131\u015fan bir \u00f6rne\u011fi (instance)<\/strong>. \u0130maj salt okunur bir \u015fablondur; container ise o \u015fablondan ba\u015flat\u0131lm\u0131\u015f, \u00fczerine kendi yaz\u0131labilir katman\u0131n\u0131 eklemi\u015f canl\u0131 bir s\u00fcre\u00e7tir.<\/p>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>\u0130maj (image)<\/th>\n<th>Container<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Ne?<\/strong><\/td>\n<td>Uygulama + ba\u011f\u0131ml\u0131l\u0131klar\u0131 + dosya sistemi \u015fablonu<\/td>\n<td>\u0130majdan ba\u015flat\u0131lm\u0131\u015f \u00e7al\u0131\u015fan (veya durmu\u015f) \u00f6rnek<\/td>\n<\/tr>\n<tr>\n<td><strong>De\u011fi\u015fir mi?<\/strong><\/td>\n<td>Hay\u0131r \u2014 salt okunur, de\u011fi\u015fmez (immutable)<\/td>\n<td>Evet \u2014 \u00fcst\u00fcne yaz\u0131labilir bir katman eklenir<\/td>\n<\/tr>\n<tr>\n<td><strong>Ka\u00e7 tane?<\/strong><\/td>\n<td>Bir imaj, bir kez indirilir<\/td>\n<td>Ayn\u0131 imajdan istedi\u011finiz kadar container ba\u015flat\u0131labilir<\/td>\n<\/tr>\n<tr>\n<td><strong>Silme komutu<\/strong><\/td>\n<td><code>docker rmi<\/code><\/td>\n<td><code>docker rm<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u0130maj, \u00fcst \u00fcste binmi\u015f katmanlardan olu\u015fur<\/h2>\n<p>Bir Dockerfile&#8217;daki her dosya de\u011fi\u015ftiren talimat (<code>RUN<\/code>, <code>COPY<\/code>, <code>ADD<\/code>) imaja yeni bir katman ekler. <code>docker history<\/code> bu katmanlar\u0131 ve her birinin boyutunu g\u00f6sterir:<\/p>\n<pre><code>FROM temel-imaj\nRUN echo a &gt; \/a\nRUN echo b &gt; \/b\nCOPY . \/app\n\n$ docker history katmanli:1 --format '{{.Size}}  {{.CreatedBy}}'\n16.4kB  COPY . \/app # buildkit\n8.19kB  RUN \/bin\/sh -c echo b &gt; \/b # buildkit\n8.19kB  RUN \/bin\/sh -c echo a &gt; \/a # buildkit\n14.9MB<\/code><\/pre>\n<p>En alttaki sat\u0131r temel imaj\u0131n kendisidir; \u00fcst\u00fcndeki her sat\u0131r, bir talimat\u0131n ekledi\u011fi farkt\u0131r. Bu yap\u0131n\u0131n iki \u00f6nemli sonucu var: katmanlar <strong>payla\u015f\u0131l\u0131r<\/strong> (ayn\u0131 temel imaj\u0131 kullanan on imaj, o katman\u0131 diskte bir kez tutar) ve katmanlar <strong>\u00f6nbelle\u011fe al\u0131n\u0131r<\/strong> (de\u011fi\u015fmeyen talimatlar yeniden \u00e7al\u0131\u015ft\u0131r\u0131lmaz \u2014 bkz. <a href=\"https:\/\/konteynerium.com\/index.php\/2026\/10\/03\/buildkit-build-cache-hizli-docker-build\/\">Build Cache ve BuildKit<\/a>).<\/p>\n<h2>Etiket (tag) bir isimdir, imaj de\u011fildir<\/h2>\n<p>Bir imaja istedi\u011finiz kadar etiket verebilirsiniz; hepsi ayn\u0131 imaj\u0131 i\u015faret eder:<\/p>\n<pre><code>$ docker tag temel:1 temel:v1\n$ docker tag temel:1 temel:latest\n$ docker images temel --format '{{.Repository}}:{{.Tag}} {{.ID}}'\ntemel:1       da40800f731b\ntemel:latest  da40800f731b\ntemel:v1      da40800f731b<\/code><\/pre>\n<p>\u00dc\u00e7 etiketin <strong>ayn\u0131 kimli\u011fi<\/strong> (ID) ta\u015f\u0131d\u0131\u011f\u0131na dikkat edin. \u0130ki yayg\u0131n yanl\u0131\u015f anlama:<\/p>\n<ul>\n<li><strong><code>:latest<\/code> &#8220;en yeni&#8221; demek de\u011fildir.<\/strong> Sadece etiket belirtmedi\u011finizde kullan\u0131lan varsay\u0131lan isimdir; birinin onu g\u00fcncelleyip g\u00fcncellemedi\u011fini garanti etmez. \u00dcretimde sabit s\u00fcr\u00fcm etiketi kullan\u0131n.<\/li>\n<li><strong>Bir etiket zamanla ba\u015fka bir imaja i\u015faret edebilir.<\/strong> Ger\u00e7ekten de\u011fi\u015fmez bir referans istiyorsan\u0131z i\u00e7erik \u00f6zetini (digest) kullan\u0131n: <code>imaj@sha256:...<\/code><\/li>\n<\/ul>\n<h2>Container&#8217;\u0131n ya\u015fam d\u00f6ng\u00fcs\u00fc<\/h2>\n<p>Bir container birka\u00e7 durumdan ge\u00e7er. <code>docker run<\/code> asl\u0131nda <code>create<\/code> + <code>start<\/code> i\u015flemlerinin k\u0131sayoludur; bunlar\u0131 ayr\u0131 ayr\u0131 \u00e7al\u0131\u015ft\u0131r\u0131nca durumlar net g\u00f6r\u00fcn\u00fcr:<\/p>\n<pre><code>$ docker create --name c1 temel:1 \/bin\/sh -c 'echo merhaba'\n$ docker ps -a --filter name=c1 --format '{{.Names}} {{.Status}}'\nc1 Created\n\n$ docker start -a c1\nmerhaba\n$ docker ps -a --filter name=c1 --format '{{.Names}} {{.Status}}'\nc1 Exited (0) Less than a second ago<\/code><\/pre>\n<table>\n<thead>\n<tr>\n<th>Durum<\/th>\n<th>Anlam\u0131<\/th>\n<th>Ge\u00e7i\u015f komutu<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>Created<\/code><\/td>\n<td>Olu\u015fturuldu, hen\u00fcz \u00e7al\u0131\u015fmad\u0131<\/td>\n<td><code>docker start<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>Up<\/code> (running)<\/td>\n<td>\u00c7al\u0131\u015f\u0131yor<\/td>\n<td><code>docker stop<\/code> \/ <code>docker kill<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>Exited (kod)<\/code><\/td>\n<td>S\u00fcre\u00e7 bitti; \u00e7\u0131k\u0131\u015f kodu 0 ba\u015far\u0131y\u0131 g\u00f6sterir<\/td>\n<td><code>docker start<\/code> \/ <code>docker rm<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><code>docker stop<\/code> \u00f6nce SIGTERM g\u00f6nderir, container belirtilen s\u00fcre i\u00e7inde (varsay\u0131lan 10 saniye) kapanmazsa SIGKILL ile sonland\u0131r\u0131r. SIGTERM&#8217;e tepki vermeyen bir s\u00fcre\u00e7te bu 10 saniyenin tamam\u0131n\u0131 beklersiniz ve \u00e7\u0131k\u0131\u015f kodu <code>137<\/code> (128 + 9) olur \u2014 container&#8217;lar\u0131n\u0131z &#8220;yava\u015f kapan\u0131yor&#8221; ise sorun genellikle uygulaman\u0131n sinyali yakalamamas\u0131d\u0131r.<\/p>\n<h2>Silerken: <code>rm<\/code> m\u0131 <code>rmi<\/code> mi?<\/h2>\n<p>Bir imaj\u0131, onu kullanan bir container (durmu\u015f olsa bile) varken silemezsiniz:<\/p>\n<pre><code>$ docker rmi temel:1\nError response from daemon: conflict: unable to delete temel:1 (must be forced)\n - container 7237f9f8a629 is using its referenced image 7096a6e93088<\/code><\/pre>\n<p>\u00d6nce container&#8217;\u0131 (<code>docker rm<\/code>), sonra imaj\u0131 (<code>docker rmi<\/code>) silin. Birden fazla etiketli bir imajda <code>docker rmi etiket<\/code> yaln\u0131zca o <em>etiketi<\/em> kald\u0131r\u0131r (<code>Untagged: temel:v1<\/code>); imaj\u0131n verisi son etiket de gidene kadar diskte kal\u0131r.<\/p>\n<div class=\"callout\">\n  <span class=\"glyph\">i<\/span><\/p>\n<p>Container i\u00e7inde yazd\u0131\u011f\u0131n\u0131z her \u015fey, container silindi\u011finde yaz\u0131labilir katman\u0131yla birlikte gider. Kal\u0131c\u0131 olmas\u0131 gereken veri i\u00e7in <a href=\"https:\/\/konteynerium.com\/index.php\/2026\/07\/24\/docker-volumes-kalici-veri-yonetimi\/\">volume<\/a> kullan\u0131n.<\/p>\n<\/div>\n<h2>H\u0131zl\u0131 \u00f6zet<\/h2>\n<ul>\n<li>\u0130maj = salt okunur \u015fablon (katmanl\u0131); container = onun \u00e7al\u0131\u015fan \u00f6rne\u011fi.<\/li>\n<li>Etiketler ayn\u0131 imaja i\u015faret eden isimlerdir; <code>:latest<\/code> \u00f6zel bir anlam ta\u015f\u0131maz.<\/li>\n<li>Container ya\u015fam d\u00f6ng\u00fcs\u00fc: <code>Created \u2192 Up \u2192 Exited<\/code>; <code>docker run<\/code> = <code>create<\/code> + <code>start<\/code>.<\/li>\n<li>Container&#8217;\u0131 <code>docker rm<\/code>, imaj\u0131 <code>docker rmi<\/code> ile silersiniz.<\/li>\n<\/ul>\n<p>S\u0131radaki ad\u0131m: kendi imaj\u0131n\u0131z\u0131 yazmak i\u00e7in <a href=\"https:\/\/konteynerium.com\/index.php\/2026\/05\/01\/dockerfile-yazmaya-giris\/\">Dockerfile Yazmaya Giri\u015f<\/a> yaz\u0131s\u0131na ge\u00e7ebilir, ya da hi\u00e7 ba\u015flamad\u0131ysan\u0131z <a href=\"https:\/\/konteynerium.com\/index.php\/2026\/04\/17\/docker-nedir-container-dunyasina-giris\/\">Docker Nedir?<\/a> yaz\u0131s\u0131yla temelleri tazeleyebilirsiniz.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0130maj ile container ayn\u0131 \u015fey de\u011fildir: imaj\u0131n katmanlar\u0131n\u0131, etiketlerin neden bir isimden ibaret oldu\u011funu ve container&#8217;\u0131n olu\u015fturulma-\u00e7al\u0131\u015fma-durma ya\u015fam d\u00f6ng\u00fcs\u00fcn\u00fc ger\u00e7ek komut \u00e7\u0131kt\u0131lar\u0131yla \u00f6\u011frenin.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"seviye":[7],"class_list":["post-611","post","type-post","status-publish","format-standard","hentry","category-temel-kavramlar","seviye-baslangic"],"_links":{"self":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/comments?post=611"}],"version-history":[{"count":0,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/posts\/611\/revisions"}],"wp:attachment":[{"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/media?parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/categories?post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/tags?post=611"},{"taxonomy":"seviye","embeddable":true,"href":"https:\/\/konteynerium.com\/index.php\/wp-json\/wp\/v2\/seviye?post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}