{"id":1375,"date":"2024-07-23T12:39:18","date_gmt":"2024-07-23T12:39:18","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1375"},"modified":"2024-07-23T12:39:18","modified_gmt":"2024-07-23T12:39:18","slug":"dockerfile-export-cache-key","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-export-cache-key\/","title":{"rendered":"Dockerfile \u2013export-cache-key"},"content":{"rendered":"<h2>Understanding Dockerfile \u2013export-cache-key: An In-Depth Exploration<\/h2>\n<p>The <code>--exporter-cl\u00e9-de-cache<\/code> option in <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is a powerful feature introduced in Docker 20.10 that allows users to specify a cache key for the build context, facilitating improved cache management and more efficient Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> builds. En d\u00e9finissant une cl\u00e9 de cache unique, les d\u00e9veloppeurs peuvent optimiser leurs processus de construction, r\u00e9duire les temps de construction et maintenir la coh\u00e9rence dans diff\u00e9rents environnements. Cet article vise \u00e0 approfondir les m\u00e9canismes, l'utilisation et les meilleures pratiques de la <code>--exporter-cl\u00e9-de-cache<\/code> option, providing insights that will enhance your <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> management skills.<\/p>\n<h2>Les bases du cache Docker<\/h2>\n<p>Before we dive into the specifics of <code>--exporter-cl\u00e9-de-cache<\/code>, it is essential to understand how Docker&#8217;s caching system works. Docker utilizes a layered filesystem architecture: each command in a <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> generates a layer in the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. When you build a Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, Docker checks its cache to see if it can reuse existing layers instead of creating new ones. If there is a cached layer that matches the command and context, Docker will use that layer, significantly speeding up the build process.<\/p>\n<p>Cependant, la mise en cache peut devenir incoh\u00e9rente, en particulier dans les environnements d'\u00e9quipe ou lors du d\u00e9ploiement sur diff\u00e9rentes infrastructures. Les modifications du contexte de construction ou des d\u00e9pendances peuvent entra\u00eener des invalidations de cache inattendues, ce qui peut entra\u00eener des temps de construction plus longs. C'est l\u00e0 que <code>--exporter-cl\u00e9-de-cache<\/code> l'option entre en jeu.<\/p>\n<h2>How <code>--exporter-cl\u00e9-de-cache<\/code> Works<\/h2>\n<p>The <code>--exporter-cl\u00e9-de-cache<\/code> option allows you to generate a distinct cache key for your build context. This cache key is a string that identifies the cache associated with your build. By associating specific cache keys with particular builds or environments, you can control which cached layers are used, enhancing your build\u2019s efficiency.<\/p>\n<h3>Syntax<\/h3>\n<p>La syntaxe g\u00e9n\u00e9rale pour utiliser <code>--exporter-cl\u00e9-de-cache<\/code> est la suivante :<\/p>\n<pre><code class=\"language-bash\">docker build --export-cache-key= -t : .<\/code><\/pre>\n<h3>Param\u00e8tres<\/h3>\n<ul>\n<li><code>--export-cache-key=<\/code>: La cl\u00e9 de cache que vous souhaitez associer \u00e0 votre contexte de construction.<\/li>\n<li><code>- :<\/code>: The name and tag you want to assign to the resulting <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<\/ul>\n<h2>Avantages de l'utilisation <code>--exporter-cl\u00e9-de-cache<\/code><\/h2>\n<h3>1. Gestion am\u00e9lior\u00e9e du cache<\/h3>\n<p>By employing unique cache keys, developers can manage the cache more effectively. For example, if a project has multiple features being developed in parallel, each feature can have its own cache key. This means that changes in one feature don\u2019t inadvertently affect the build cache of another, leading to more predictable builds.<\/p>\n<h3>2. R\u00e9duction des temps de construction<\/h3>\n<p>En utilisant <code>--exporter-cl\u00e9-de-cache<\/code> peut r\u00e9duire consid\u00e9rablement les temps de construction en minimisant l'invalidation inutile du cache. Lorsqu'un contexte de construction reste inchang\u00e9 mais n'est par ailleurs pas li\u00e9 \u00e0 la construction actuelle, les d\u00e9veloppeurs peuvent utiliser la m\u00eame cl\u00e9 de cache pour exploiter les couches existantes, ce qui acc\u00e9l\u00e8re le processus de construction.<\/p>\n<h3>Coh\u00e9rence \u00e0 travers les environnements<\/h3>\n<p>Dans les pipelines CI\/CD modernes, la coh\u00e9rence est essentielle. En utilisant des cl\u00e9s de cache, vous pouvez vous assurer que le m\u00eame cache est utilis\u00e9 dans diff\u00e9rents environnements et configurations de machines, r\u00e9duisant ainsi le syndrome du \"\u00e7a marche sur ma machine\".<\/p>\n<h2>Cas d'utilisation dans le monde r\u00e9el<\/h2>\n<p>To illustrate the advantages of <code>--exporter-cl\u00e9-de-cache<\/code>, let\u2019s look at a few real-world scenarios where this feature can be beneficial.<\/p>\n<h3>Exemple 1 : Plusieurs branches de fonctionnalit\u00e9s<\/h3>\n<p>Imagine a scenario where developers are working on different features in parallel, each in its own branch. Without <code>--exporter-cl\u00e9-de-cache<\/code>, any changes to the <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in one branch might inadvertently invalidate the cache in another branch, leading to unnecessary rebuilds.<\/p>\n<p>By implementing unique cache keys for each feature branch, you can prevent this issue. For instance:<\/p>\n<pre><code class=\"language-bash\"># Pour la fonctionnalit\u00e9 A\ndocker build --export-cache-key=featureA-cache -t myapp:featureA .\n\n# Pour la fonctionnalit\u00e9 B\ndocker build --export-cache-key=featureB-cache -t myapp:featureB .<\/code><\/pre>\n<h3>Exemple 2 : Pipelines CI\/CD<\/h3>\n<p>In CI\/CD environments, builds are frequently triggered for the same codebase. This can lead to redundant builds if the build context remains the same. By employing <code>--exporter-cl\u00e9-de-cache<\/code>, you can ensure that builds reuse existing layers whenever possible.<\/p>\n<pre><code class=\"language-bash\">docker build --export-cache-key=ci-build-cache -t myapp:latest .<\/code><\/pre>\n<h3>Exemple 3 : Constructions multi-\u00e9tapes<\/h3>\n<p>Lors de l'utilisation de constructions multi-\u00e9tapes, certaines \u00e9tapes peuvent subir des modifications fr\u00e9quentes tandis que d'autres restent constantes. En attribuant diff\u00e9rentes cl\u00e9s de cache \u00e0 diff\u00e9rentes \u00e9tapes, vous pouvez optimiser davantage le processus de construction.<\/p>\n<pre><code class=\"language-dockerfile\"># \u00c9tape 1 : Base  \nDEPUIS <span class=\"glossaryai-tooltip glossary-term-684\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/node\/\" target=\"_blank\">n\u0153ud<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Node, or Node.js, is a JavaScript runtime built on Chrome's V8 engine, enabling server-side scripting. It allows developers to build scalable network applications using asynchronous, event-driven architecture.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/node\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>14\u00a0:14 AS base\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPIE<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">COPY is a command in computer programming and data management that facilitates the duplication of files or data from one location to another, ensuring data integrity and accessibility.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> package.json yarn.lock .\/\n<span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">RUN<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> yarn install\n\n# Stage 2: Build\nFROM base AS build\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPIE<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">COPY is a command in computer programming and data management that facilitates the duplication of files or data from one location to another, ensuring data integrity and accessibility.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> . .\n<span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">RUN<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> yarn build\n\n# Export cache for the build stage\ndocker build --export-cache-key=build-cache -t myapp:build .<\/code><\/pre>\n<h2>Meilleures pratiques pour l'utilisation <code>--exporter-cl\u00e9-de-cache<\/code><\/h2>\n<h3>D\u00e9finir des cl\u00e9s de cache significatives<\/h3>\n<p>La cr\u00e9ation de cl\u00e9s de cache pertinentes vous aidera \u00e0 g\u00e9rer efficacement vos builds. \u00c9vitez les cl\u00e9s g\u00e9n\u00e9riques ; pr\u00e9f\u00e9rez plut\u00f4t des noms descriptifs qui refl\u00e8tent l'objectif du contexte de build qu'ils repr\u00e9sentent. Par exemple, utiliser des noms de branche ou des descriptions de fonctionnalit\u00e9s peut \u00eatre utile.<\/p>\n<h3>2. Combinez avec Docker BuildKit<\/h3>\n<p><code>--exporter-cl\u00e9-de-cache<\/code> works best when combined with Docker BuildKit, which offers advanced features for <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> building. Enabling BuildKit can be done by setting the environment variable:<\/p>\n<pre><code class=\"language-bash\">export DOCKER_BUILDKIT=1<\/code><\/pre>\n<h3>3. Examinez r\u00e9guli\u00e8rement vos cl\u00e9s de cache<\/h3>\n<p>As your project evolves, so should your cache management strategy. Regularly review your cache keys to ensure they still serve their intended purpose. This will help you identify any redundancy or opportunities for further optimization.<\/p>\n<h3>4. Utilisez les contextes de construction de mani\u00e8re judicieuse<\/h3>\n<p>Soyez attentif aux fichiers et r\u00e9pertoires que vous incluez dans votre contexte de construction. Les fichiers volumineux et inutiles peuvent ralentir les constructions et peuvent entra\u00eener une invalidation du cache. Utilisez <code>.dockerignore<\/code> des fichiers efficacement pour rationaliser votre contexte de construction.<\/p>\n<h3>5. Monitor Build Performance<\/h3>\n<p>Utilisez les outils de journalisation int\u00e9gr\u00e9s de Docker pour surveiller les performances de construction. Cela peut vous aider \u00e0 identifier les domaines o\u00f9 l'utilisation du cache est sous-optimale, vous permettant d'affiner votre strat\u00e9gie de cl\u00e9s de cache au fil du temps.<\/p>\n<h2>Conclusion<\/h2>\n<p>The <code>--exporter-cl\u00e9-de-cache<\/code> feature introduces a new level of efficiency and control to Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> builds. By allowing developers to specify cache keys, it promotes better cache management, reduced build times, and consistency across different environments. As development practices continue to evolve, leveraging features like <code>--exporter-cl\u00e9-de-cache<\/code> will be crucial for maintaining optimal build processes.<\/p>\n<p>Incorporating this feature into your <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> practices can transform your build experience, particularly in collaborative and CI\/CD environments. By understanding its mechanics and implementing the best practices outlined in this article, you&#8217;ll be well-equipped to make the most of Docker&#8217;s caching capabilities. As you explore this powerful tool, remember that effective cache management is not just a matter of convenience; it\u2019s an integral part of modern software development that fosters greater productivity, efficiency, and consistency.<\/p>","protected":false},"excerpt":{"rendered":"<p>The `\u2013export-cache-key` option in <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> optimise <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Une image est une repr\u00e9sentation visuelle d'un objet ou d'une sc\u00e8ne, g\u00e9n\u00e9ralement compos\u00e9e de pixels dans les formats num\u00e9riques. Elle peut transmettre des informations, susciter des \u00e9motions et faciliter la communication \u00e0 travers diff\u00e9rents m\u00e9dias.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> builds by allowing developers to specify a cache key for exported layers. This enhances build performance and consistency, minimizing unnecessary rebuilds.<\/p>","protected":false},"author":1,"featured_media":2063,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1375","glossary","type-glossary","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Dockerfile -export-cache-key - Dockerpros<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-export-cache-key\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dockerfile -export-cache-key - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"The `--export-cache-key` option in Dockerfile optimizes image builds by allowing developers to specify a cache key for exported layers. This enhances build performance and consistency, minimizing unnecessary rebuilds.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-export-cache-key\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/\",\"name\":\"Dockerfile -export-cache-key - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg\",\"datePublished\":\"2024-07-23T12:39:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg\",\"width\":800,\"height\":600,\"caption\":\"dockerfile-export-cache-key-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dockerpros.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Glossary\",\"item\":\"https:\/\/dockerpros.com\/fr\/wiki\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Dockerfile &#8211;export-cache-key\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dockerpros.com\/#website\",\"url\":\"https:\/\/dockerpros.com\/\",\"name\":\"Dockerpros\",\"description\":\"DockerPros \u2013 Your Ultimate Docker Resource Hub\",\"publisher\":{\"@id\":\"https:\/\/dockerpros.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dockerpros.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dockerpros.com\/#organization\",\"name\":\"Dockerpros\",\"url\":\"https:\/\/dockerpros.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png\",\"width\":532,\"height\":114,\"caption\":\"Dockerpros\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dockerfile -export-cache-key - Dockerpros","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-export-cache-key\/","og_locale":"fr_FR","og_type":"article","og_title":"Dockerfile -export-cache-key - Dockerpros","og_description":"The `--export-cache-key` option in Dockerfile optimizes image builds by allowing developers to specify a cache key for exported layers. This enhances build performance and consistency, minimizing unnecessary rebuilds.","og_url":"https:\/\/dockerpros.com\/fr\/wiki\/dockerfile-export-cache-key\/","og_site_name":"Dockerpros","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/","url":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/","name":"Dockerfile -export-cache-key - Dockerpros","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg","datePublished":"2024-07-23T12:39:18+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/dockerfile-export-cache-key_1375.jpg","width":800,"height":600,"caption":"dockerfile-export-cache-key-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/dockerfile-export-cache-key\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dockerpros.com\/"},{"@type":"ListItem","position":2,"name":"Glossary","item":"https:\/\/dockerpros.com\/fr\/wiki\/"},{"@type":"ListItem","position":3,"name":"Dockerfile &#8211;export-cache-key"}]},{"@type":"WebSite","@id":"https:\/\/dockerpros.com\/#website","url":"https:\/\/dockerpros.com\/","name":"Dockerpros","description":"DockerPros \u2013 Votre centre de ressources Docker incontournable","publisher":{"@id":"https:\/\/dockerpros.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dockerpros.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/dockerpros.com\/#organization","name":"Dockerpros","url":"https:\/\/dockerpros.com\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png","width":532,"height":114,"caption":"Dockerpros"},"image":{"@id":"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary\/1375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary"}],"about":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/types\/glossary"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary\/1375\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media\/2063"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media?parent=1375"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary-cat?post=1375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}