{"id":564,"date":"2024-07-22T12:30:14","date_gmt":"2024-07-22T12:30:14","guid":{"rendered":"https:\/\/dockerpros.com\/?p=564"},"modified":"2024-07-22T12:30:14","modified_gmt":"2024-07-22T12:30:14","slug":"optimisation-des-images-docker-avec-des-techniques-de-build-multi-etapes","status":"publish","type":"post","link":"https:\/\/dockerpros.com\/fr\/container-creation-and-management\/optimizing-docker-images-with-multi-stage-build-techniques\/","title":{"rendered":"Optimisation des images Docker avec les techniques de construction multi-\u00e9tapes\n\nLes images Docker sont essentielles pour le d\u00e9ploiement d'applications dans des environnements conteneuris\u00e9s. Cependant, la taille des images peut avoir un impact significatif sur les performances et l'efficacit\u00e9. Les techniques de construction multi-\u00e9tapes offrent une solution puissante pour optimiser les images Docker en r\u00e9duisant leur taille et en am\u00e9liorant leur s\u00e9curit\u00e9.\n\nQu'est-ce qu'une construction multi-\u00e9tapes ?\n\nUne construction multi-\u00e9tapes est une fonctionnalit\u00e9 de Docker qui permet de cr\u00e9er des images en plusieurs \u00e9tapes, chacune ayant son propre contexte et ses propres instructions. Cette approche permet de s\u00e9parer le processus de construction de l'image finale, ce qui permet d'inclure uniquement les artefacts n\u00e9cessaires dans l'image finale.\n\nAvantages de l'utilisation de constructions multi-\u00e9tapes\n\n1. R\u00e9duction de la taille de l'image : En s\u00e9parant le processus de construction de l'image finale, vous pouvez \u00e9liminer les d\u00e9pendances et les fichiers inutiles, ce qui se traduit par une image plus petite et plus efficace.\n\n2. Am\u00e9lioration de la s\u00e9curit\u00e9 : Les constructions multi-\u00e9tapes permettent d'exclure les outils et biblioth\u00e8ques sensibles utilis\u00e9s pendant le processus de construction de l'image finale, r\u00e9duisant ainsi la surface d'attaque.\n\n3. Processus de construction rationalis\u00e9 : En utilisant plusieurs \u00e9tapes, vous pouvez optimiser le processus de construction en r\u00e9utilisant les couches et en minimisant le nombre d'instructions dans l'image finale.\n\nTechniques pour optimiser les images Docker avec des constructions multi-\u00e9tapes\n\n1. Utiliser des images de base distinctes : Commencez par une image de base l\u00e9g\u00e8re pour l'\u00e9tape de construction, puis passez \u00e0 une image de base plus appropri\u00e9e pour l'image finale. Cela garantit que seuls les composants n\u00e9cessaires sont inclus dans l'image finale.\n\n2. Copier s\u00e9lectivement les artefacts : Utilisez l'instruction COPY --from pour copier s\u00e9lectivement les artefacts de l'\u00e9tape de construction vers l'image finale. Cela vous permet d'inclure uniquement les fichiers et r\u00e9pertoires n\u00e9cessaires, en excluant tout composant superflu.\n\n3. Nettoyer les d\u00e9pendances de construction : Apr\u00e8s avoir termin\u00e9 l'\u00e9tape de construction, nettoyez toutes les d\u00e9pendances et fichiers temporaires qui ne sont plus n\u00e9cessaires. Cela r\u00e9duit encore la taille de l'image finale.\n\n4. Tirer parti de la mise en cache des couches : Docker met en cache les couches pendant le processus de construction. En organisant vos instructions de mani\u00e8re \u00e0 maximiser la r\u00e9utilisation des couches, vous pouvez acc\u00e9l\u00e9rer consid\u00e9rablement le processus de construction.\n\nExemple de construction multi-\u00e9tapes\n\nFROM golang:1.16 AS builder\nWORKDIR \/app\nCOPY go.mod go.sum .\/\nRUN go mod download\nCOPY . .\nRUN CGO_ENABLED=0 GOOS=linux go build -o myapp\n\nFROM alpine:latest\nRUN apk --no-cache add ca-certificates\nWORKDIR \/root\/\nCOPY --from=builder \/app\/myapp .\nCMD [\".\/myapp\"]\n\nDans cet exemple, nous utilisons une image Go comme image de base pour l'\u00e9tape de construction, puis nous passons \u00e0 une image Alpine pour l'image finale. L'instruction COPY --from copie l'ex\u00e9cutable compil\u00e9 de l'\u00e9tape de construction vers l'image finale, ce qui donne une image l\u00e9g\u00e8re et s\u00e9curis\u00e9e.\n\nConclusion\n\nLes techniques de construction multi-\u00e9tapes offrent un moyen puissant d'optimiser les images Docker en r\u00e9duisant leur taille, en am\u00e9liorant leur s\u00e9curit\u00e9 et en rationalisant le processus de construction. En s\u00e9parant le processus de construction de l'image finale et en incluant s\u00e9lectivement les artefacts n\u00e9cessaires, vous pouvez cr\u00e9er des images efficaces et s\u00e9curis\u00e9es pour vos applications conteneuris\u00e9es."},"content":{"rendered":"<h1>Multi-Stage Builds: Building Efficient Docker Images<\/h1>\n<p>Docker has revolutionized the way we deploy and manage applications. One of the most significant innovations in Docker is the concept of multi-stage builds, which allows developers to create optimized, efficient Docker images with minimal size and improved build time. In this article, we\u2019ll explore the intricacies of multi-stage builds, their advantages, and best practices to ensure you get the most out of this powerful feature.<\/p>\n<h2>Understanding Docker Images and Layers<\/h2>\n<p>Before diving into multi-stage builds, it\u2019s essential to understand how Docker images work. 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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is a read-only template that contains everything needed to <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> an application, including code, libraries, and system tools. Images are made up of layers, where each layer represents a set of changes made to the base <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. Layers are stacked on top of each other, and Docker uses a copy-on-write mechanism to manage these layers efficiently.<\/p>\n<p>Each layer is cached after it\u2019s created, which means that when you rebuild an <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, Docker can skip unchanged layers, potentially speeding up the build process. However, as applications become more complex, Docker images can grow large, leading to slower deployment times and increased resource usage.<\/p>\n<h2>The Problem with Traditional Docker Builds<\/h2>\n<p>In traditional Docker builds, developers often include all the tools and dependencies required during the build process in the final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. For example, when building a Go application, 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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> might contain the Go compiler, build tools, and libraries. This approach results in:<\/p>\n<ul>\n<li><strong>Larger <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Size<\/strong>: The final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> includes unnecessary build tools, bloating the size.<\/li>\n<li><strong>Security Risks<\/strong>: Including build tools and dependencies increases the attack surface of 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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<li><strong>Longer Deployment Times<\/strong>: Larger images take longer to transfer to production environments.<\/li>\n<\/ul>\n<p>To address these issues, Docker introduced multi-stage builds, allowing you to separate the build environment from the final runtime environment.<\/p>\n<h2>What Are Multi-Stage Builds?<\/h2>\n<p>Multi-stage builds allow you to use multiple <code>FROM<\/code> statements in the same <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> to create separate build environments. Each stage can have its own base <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, which means you can use more extensive images for building and lighter images for production. The final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> can then <span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">copy<\/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> only the necessary artifacts from the intermediate stages, significantly reducing 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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> size.<\/p>\n<p>Here\u2019s the basic syntax of a <span class=\"glossaryai-tooltip glossary-term-740\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/multi-stage-build\/\" target=\"_blank\">multi-stage build<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A multi-stage build is a Docker optimization technique that enables the separation of build and runtime environments. By using multiple FROM statements in a single Dockerfile, developers can streamline image size and enhance security by excluding unnecessary build dependencies in the final image.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/multi-stage-build\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-Dockerfile\"># Stage 1: Builder\nFROM golang:1.16 AS builder\nWORKDIR \/app\nCOPY . .\nRUN go build -o myapp\n\n# Stage 2: Final Image\nFROM alpine:latest\nWORKDIR \/app\nCOPY --from=builder \/app\/myapp .\nCMD [\".\/myapp\"]<\/code><\/pre>\n<p>In this example, we have two stages: the first stage compiles a Go application, while the second stage creates a minimal Alpine <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> that runs the application. The final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> contains only the compiled binary, excluding the Go compiler and any other build tools.<\/p>\n<h2>Advantages of Multi-Stage Builds<\/h2>\n<h3>1. Reduced Image Size<\/h3>\n<p>By copying only the necessary artifacts from the build stage, you can significantly reduce the size of your final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. This reduction leads to faster deployments and less disk space usage.<\/p>\n<h3>2. Improved Build Times<\/h3>\n<p>Multi-stage builds allow you to cache intermediate layers effectively. When you change code in the source stage, Docker can reuse the unchanged layers, speeding up the build process.<\/p>\n<h3>3. Enhanced Security<\/h3>\n<p>By excluding build tools and unnecessary dependencies from the final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, you reduce the attack surface and improve the security posture of your application.<\/p>\n<h3>4. Simplified Dockerfile Management<\/h3>\n<p>With multi-stage builds, you can keep all build-related instructions within a single <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>. This approach makes it easier to manage your Docker configurations and reduces the risk of inconsistencies across multiple Dockerfiles.<\/p>\n<h3>5. Language and Framework Agnostic<\/h3>\n<p>Multi-stage builds can be applied to any programming language or framework. Whether you&#8217;re building a <span class=\"glossaryai-tooltip glossary-term-684\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/node\/\" target=\"_blank\">Node<\/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>.js application, a Java <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, or a Python script, you can take advantage of this feature to optimize your Docker images.<\/p>\n<h2>Best Practices for Multi-Stage Builds<\/h2>\n<p>While multi-stage builds offer numerous benefits, following best practices can help you maximize their effectiveness:<\/p>\n<h3>1. Use Specific Base Images<\/h3>\n<p>Choose base images that are optimized for your use case. For example, use <code>alpine<\/code> for lightweight production images or <code>debian<\/code> for images needing more extensive libraries. This choice can significantly impact the final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> size.<\/p>\n<h3>2. Minimize Dependencies<\/h3>\n<p>Only include dependencies that are necessary for your application to <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>. Review 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> and ensure that you are not unintentionally including development dependencies in the final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/p>\n<h3>3. Keep Build Stages Separate<\/h3>\n<p>Organize 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> to keep build stages distinct. This clarity helps maintain 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> and understand the build process. Group similar tasks together to improve readability.<\/p>\n<h3>4. Leverage Build Arguments<\/h3>\n<p>Use build arguments to customize your build process based on the environment (development, testing, production). Build arguments allow you to pass variables to your build process, enabling you to avoid hardcoding values in 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>.<\/p>\n<pre><code class=\"language-Dockerfile\"><span class=\"glossaryai-tooltip glossary-term-679\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/arg\/\" target=\"_blank\">ARG<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">ARG is a directive used within Dockerfiles to define build-time variables that allow you to parameterize your builds. These variables can influence how an image is constructed, enabling developers to create more flexible and reusable Docker images.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/arg\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> NODE_ENV=production\nFROM <span class=\"glossaryai-tooltip glossary-term-684\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/node\/\" target=\"_blank\">node<\/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 AS builder\n<span class=\"glossaryai-tooltip glossary-term-675\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/workdir\/\" target=\"_blank\">WORKDIR<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The `WORKDIR` instruction in Dockerfile sets the working directory for subsequent instructions. It simplifies path management, as all relative paths will be resolved from this directory, enhancing build clarity.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/workdir\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> \/app\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPY<\/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 .\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> npm install --only=$NODE_ENV\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPY<\/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> npm <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> build<\/code><\/pre>\n<h3>5. Optimize COPY Instructions<\/h3>\n<p>Use specific paths in your <code><span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPY<\/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><\/code> statements to avoid copying unnecessary files. The more specific you are, the smaller your <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> size will be. For example, instead of copying everything from your source directory:<\/p>\n<pre><code class=\"language-Dockerfile\"><span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPY<\/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> . .<\/code><\/pre>\n<p>Consider copying only what\u2019s needed:<\/p>\n<pre><code class=\"language-Dockerfile\"><span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPY<\/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> src\/ .\/src\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/copy\/\" target=\"_blank\">COPY<\/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 .\/<\/code><\/pre>\n<h3>6. Clean Up After Build<\/h3>\n<p>If your build process generates temporary files or unnecessary artifacts, make sure to clean them up in the build stage. You can use <code><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><\/code> commands to remove unneeded files to keep 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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> size small.<\/p>\n<pre><code class=\"language-Dockerfile\"><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> npm install &amp;&amp; npm cache clean --force<\/code><\/pre>\n<h3>7. Multi-Stage Testing<\/h3>\n<p>You can also incorporate testing within your multi-stage builds. Create a separate stage for running tests to ensure your application is functioning as expected before moving to the final <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/p>\n<pre><code class=\"language-Dockerfile\"># Stage 1: Builder\nFROM node:14 AS builder\nWORKDIR \/app\nCOPY package.json .\nRUN npm install\nCOPY . .\n\n# Stage 2: Test\nFROM builder AS tester\nRUN npm test\n\n# Stage 3: Final Image\nFROM alpine:latest\nWORKDIR \/app\nCOPY --from=builder \/app .\nCMD [\"node\", \"src\/index.js\"]<\/code><\/pre>\n<h2>Debugging Multi-Stage Builds<\/h2>\n<p>Debugging multi-stage builds can be challenging, especially when issues arise. Here are some tips to help you troubleshoot:<\/p>\n<h3>1. Use Intermediate Containers<\/h3>\n<p>If you encounter errors during the build process, you can <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> an intermediate <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">container<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> from any stage of 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>. To do this, build 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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> up to the desired stage and then <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> a <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">container<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> based on that stage:<\/p>\n<pre><code class=\"language-bash\">docker build --target builder -t myapp:builder .\ndocker <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> -it myapp:builder \/bin\/sh<\/code><\/pre>\n<h3>2. Output Logs<\/h3>\n<p>Incorporate logging into your build process to capture output from your scripts and commands. You can use <code><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><\/code> commands to log output to a file or the console to diagnose issues:<\/p>\n<pre><code class=\"language-Dockerfile\">RUN npm run build &amp;&amp; echo \"Build completed\" || echo \"Build failed\"<\/code><\/pre>\n<h3>3. Inspect Layers<\/h3>\n<p>You can inspect the layers of your <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> using the <code>docker history<\/code> command. This command shows the size and commands associated with each layer, helping you identify potential issues:<\/p>\n<pre><code class=\"language-bash\">docker history myapp<\/code><\/pre>\n<h3>4. Test Incrementally<\/h3>\n<p>When making changes to 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>, test incrementally to isolate issues. Start with a simple build and gradually <span class=\"glossaryai-tooltip glossary-term-674\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/add\/\" target=\"_blank\">add<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The ADD instruction in Docker is a command used in Dockerfiles to copy files and directories from a host machine into a Docker image during the build process. It not only facilitates the transfer of local files but also provides additional functionality, such as automatically extracting compressed files and fetching remote files via HTTP or HTTPS.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/add\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> complexity, ensuring that each addition works as expected.<\/p>\n<h2>Conclusion<\/h2>\n<p>Multi-stage builds are a powerful feature of Docker that can help you create efficient, secure, and optimized images for your applications. By separating the build environment from the final runtime environment, you can reduce <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\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> size, improve build times, and enhance security.<\/p>\n<p>By following the best practices outlined in this article, you can take full advantage of multi-stage builds to streamline your Docker workflows and ensure your applications deploy smoothly across various environments. As you become more proficient with this feature, you&#8217;ll find new ways to apply it in your projects, leading to a more efficient and effective development process.<\/p>\n<p>Whether you are a seasoned Docker user or just getting started, multi-stage builds can significantly enhance your Docker experience and give you a competitive edge in the ever-evolving software development landscape.<\/p>","protected":false},"excerpt":{"rendered":"<p>L'optimisation des images Docker \u00e0 l'aide de builds multi-\u00e9tapes permet aux d\u00e9veloppeurs de cr\u00e9er des images plus petites et plus efficaces en s\u00e9parant l'environnement de construction de l'environnement d'ex\u00e9cution, r\u00e9duisant ainsi les d\u00e9pendances inutiles.<\/p>","protected":false},"author":1,"featured_media":959,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-564","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-container-creation-and-management"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Optimizing Docker Images with Multi-Stage Build Techniques - 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\/creation-et-gestion-de-conteneurs\/optimisation-des-images-docker-avec-des-techniques-de-build-multi-etapes\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Optimizing Docker Images with Multi-Stage Build Techniques - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"Optimizing Docker images using multi-stage builds allows developers to create smaller, more efficient images by separating the build environment from the runtime environment, reducing unnecessary dependencies.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/fr\/creation-et-gestion-de-conteneurs\/optimisation-des-images-docker-avec-des-techniques-de-build-multi-etapes\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-22T12:30:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.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=\"author\" content=\"dockerpros\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"dockerpros\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/\"},\"author\":{\"name\":\"dockerpros\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4\"},\"headline\":\"Optimizing Docker Images with Multi-Stage Build Techniques\",\"datePublished\":\"2024-07-22T12:30:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/\"},\"wordCount\":1155,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dockerpros.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg\",\"articleSection\":[\"Container Creation and Management\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/\",\"url\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/\",\"name\":\"Optimizing Docker Images with Multi-Stage Build Techniques - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg\",\"datePublished\":\"2024-07-22T12:30:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg\",\"width\":800,\"height\":600,\"caption\":\"optimizing-docker-images-with-multi-stage-build-techniques-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dockerpros.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Optimizing Docker Images with Multi-Stage Build Techniques\"}]},{\"@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\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4\",\"name\":\"dockerpros\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442\",\"caption\":\"dockerpros\"},\"sameAs\":[\"https:\/\/dockerpros.com\/\"],\"url\":\"https:\/\/dockerpros.com\/fr\/author\/dockerpros\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Optimizing Docker Images with Multi-Stage Build Techniques - 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\/creation-et-gestion-de-conteneurs\/optimisation-des-images-docker-avec-des-techniques-de-build-multi-etapes\/","og_locale":"fr_FR","og_type":"article","og_title":"Optimizing Docker Images with Multi-Stage Build Techniques - Dockerpros","og_description":"Optimizing Docker images using multi-stage builds allows developers to create smaller, more efficient images by separating the build environment from the runtime environment, reducing unnecessary dependencies.","og_url":"https:\/\/dockerpros.com\/fr\/creation-et-gestion-de-conteneurs\/optimisation-des-images-docker-avec-des-techniques-de-build-multi-etapes\/","og_site_name":"Dockerpros","article_published_time":"2024-07-22T12:30:14+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg","type":"image\/jpeg"}],"author":"dockerpros","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"dockerpros","Dur\u00e9e de lecture estim\u00e9e":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#article","isPartOf":{"@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/"},"author":{"name":"dockerpros","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4"},"headline":"Optimizing Docker Images with Multi-Stage Build Techniques","datePublished":"2024-07-22T12:30:14+00:00","mainEntityOfPage":{"@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/"},"wordCount":1155,"commentCount":0,"publisher":{"@id":"https:\/\/dockerpros.com\/#organization"},"image":{"@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg","articleSection":["Container Creation and Management"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/","url":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/","name":"Optimizing Docker Images with Multi-Stage Build Techniques - Dockerpros","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg","datePublished":"2024-07-22T12:30:14+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/optimizing-docker-images-with-multi-stage-build-techniques_564.jpg","width":800,"height":600,"caption":"optimizing-docker-images-with-multi-stage-build-techniques-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/de\/container-creation-and-management\/optimierung-von-docker-images-mit-mehrstufigen-build-techniken\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dockerpros.com\/"},{"@type":"ListItem","position":2,"name":"Optimizing Docker Images with Multi-Stage Build Techniques"}]},{"@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\/"}},{"@type":"Person","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4","name":"professionnels Docker","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/image\/","url":"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442","contentUrl":"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442","caption":"dockerpros"},"sameAs":["https:\/\/dockerpros.com\/"],"url":"https:\/\/dockerpros.com\/fr\/author\/dockerpros\/"}]}},"_links":{"self":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/posts\/564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/comments?post=564"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/posts\/564\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media\/959"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media?parent=564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/categories?post=564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/tags?post=564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}