{"id":1247,"date":"2024-07-23T12:16:15","date_gmt":"2024-07-23T12:16:15","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1247"},"modified":"2024-07-23T12:21:40","modified_gmt":"2024-07-23T12:21:40","slug":"docker-build-export","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/fr\/wiki\/docker-build-export\/","title":{"rendered":"Construction et exportation Docker"},"content":{"rendered":"<h1>Guide avanc\u00e9 sur l'exportation de la construction Docker\n\nL'exportation de la construction Docker est une fonctionnalit\u00e9 puissante qui permet aux d\u00e9veloppeurs de cr\u00e9er, de partager et de d\u00e9ployer des applications conteneuris\u00e9es de mani\u00e8re efficace. Ce guide avanc\u00e9 explorera les diff\u00e9rentes m\u00e9thodes d'exportation de la construction Docker, leurs avantages et leurs cas d'utilisation.\n\n1. Exporter une image Docker\n\nLa m\u00e9thode la plus courante pour exporter une construction Docker est d'utiliser la commande `docker save`. Cette commande cr\u00e9e une archive tarball contenant l'image Docker et ses m\u00e9tadonn\u00e9es. Voici un exemple :\n\n```bash\ndocker save -o my-image.tar my-image:latest\n```\n\nCette commande exporte l'image `my-image:latest` dans un fichier nomm\u00e9 `my-image.tar`. Vous pouvez ensuite transf\u00e9rer ce fichier vers un autre h\u00f4te et l'importer \u00e0 l'aide de la commande `docker load` :\n\n```bash\ndocker load -i my-image.tar\n```\n\n2. Exporter un conteneur Docker\n\nSi vous souhaitez exporter un conteneur Docker sp\u00e9cifique plut\u00f4t qu'une image, vous pouvez utiliser la commande `docker export`. Cette commande cr\u00e9e une archive tarball contenant le syst\u00e8me de fichiers du conteneur. Voici un exemple :\n\n```bash\ndocker export -o my-container.tar my-container\n```\n\nCette commande exporte le conteneur `my-container` dans un fichier nomm\u00e9 `my-container.tar`. Vous pouvez ensuite importer ce fichier \u00e0 l'aide de la commande `docker import` :\n\n```bash\ndocker import my-container.tar my-new-image:latest\n```\n\n3. Exporter vers un registre Docker\n\nUne autre m\u00e9thode pour exporter une construction Docker est de la pousser vers un registre Docker, tel que Docker Hub ou un registre priv\u00e9. Cela permet de partager facilement l'image avec d'autres d\u00e9veloppeurs ou de la d\u00e9ployer sur diff\u00e9rents environnements. Voici un exemple :\n\n```bash\ndocker tag my-image:latest my-registry.com\/my-image:latest\ndocker push my-registry.com\/my-image:latest\n```\n\nCette commande \u00e9tiquette l'image `my-image:latest` avec le nom du registre et la pousse vers le registre.\n\n4. Exporter vers un fichier Docker Compose\n\nSi vous utilisez Docker Compose pour d\u00e9finir et ex\u00e9cuter des applications multi-conteneurs, vous pouvez exporter votre construction vers un fichier Docker Compose. Cela vous permet de d\u00e9finir l'ensemble de votre application, y compris plusieurs services, r\u00e9seaux et volumes, dans un seul fichier. Voici un exemple :\n\n```yaml\nversion: '3'\nservices:\n  web:\n    build: .\n    ports:\n      - \"5000:5000\"\n  redis:\n    image: \"redis:alpine\"\n```\n\nCe fichier Docker Compose d\u00e9finit deux services : un service web qui construit \u00e0 partir du Dockerfile actuel et expose le port 5000, et un service Redis utilisant l'image Redis Alpine.\n\n5. Exporter vers un fichier Docker Stack\n\nSi vous utilisez Docker Swarm pour orchestrer vos conteneurs, vous pouvez exporter votre construction vers un fichier Docker Stack. Cela vous permet de d\u00e9finir et de d\u00e9ployer des applications multi-services sur un cluster Swarm. Voici un exemple :\n\n```yaml\nversion: '3.7'\nservices:\n  web:\n    image: my-image:latest\n    deploy:\n      replicas: 3\n      resources:\n        limits:\n          cpus: '0.5'\n          memory: 512M\n      restart_policy:\n        condition: on-failure\n  redis:\n    image: \"redis:alpine\"\n```\n\nCe fichier Docker Stack d\u00e9finit deux services : un service web utilisant l'image `my-image:latest` avec trois r\u00e9plicas et des limites de ressources, et un service Redis utilisant l'image Redis Alpine.\n\nEn conclusion, l'exportation de la construction Docker offre plusieurs m\u00e9thodes pour cr\u00e9er, partager et d\u00e9ployer des applications conteneuris\u00e9es. Que vous choisissiez d'exporter une image, un conteneur, de pousser vers un registre, ou d'utiliser Docker Compose ou Docker Stack, ces techniques vous permettent de rationaliser votre flux de travail de d\u00e9veloppement et de d\u00e9ploiement.<\/h1>\n<p>L'exportation de la construction Docker, une commande qui joue un r\u00f4le central dans l'\u00e9cosyst\u00e8me Docker, fait r\u00e9f\u00e9rence \u00e0 la capacit\u00e9 d'exporter le syst\u00e8me de fichiers d'une construction <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> or <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/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> to a tar archive. This functionality allows developers and system administrators to transfer the contents of 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> or <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/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> in a portable format. By understanding and leveraging this feature, users can streamline their workflows, share Docker images across different environments, and deploy applications more efficiently.<\/p>\n<h2>Understanding Docker Image and Container Architecture<\/h2>\n<p>Before diving into the specifics of Docker Build Export, it is essential to clarify some fundamental concepts related to Docker images and containers. <\/p>\n<p>A <strong>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><\/strong> is a lightweight, standalone, executable package that includes 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> a piece of software, including the code, runtime, libraries, environment variables, and configuration files. Docker images are created from a series of layers, each representing a set of changes made to the file system. These layers are derived from a 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\">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> (often an OS or a minimal <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>) and are built using 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>, which contains a set of instructions on how to assemble 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>.<\/p>\n<p>A <strong><span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/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><\/strong>, on the other hand, is a running instance of 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>. Containers are ephemeral; they can be created, started, stopped, deleted, and replicated quickly. Each <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/container\/\" target=\"_blank\">conteneur<\/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> operates in isolation from others, ensuring that various applications 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> with different dependencies without conflict.<\/p>\n<h2>Le besoin d'exporter la construction Docker<\/h2>\n<p>Dans le contexte du d\u00e9veloppement et du d\u00e9ploiement d'applications, la n\u00e9cessit\u00e9 de Docker Build Export d\u00e9coule de plusieurs sc\u00e9narios :<\/p>\n<ol>\n<li>\n<p><strong>Portabilit\u00e9<\/strong>Les images Docker peuvent \u00eatre d\u00e9plac\u00e9es entre diff\u00e9rents environnements (d\u00e9veloppement, test, production). Exporter les images au format tar simplifie ce processus en cr\u00e9ant un seul fichier facilement transf\u00e9rable.<\/p>\n<\/li>\n<li>\n<p><strong>Backup<\/strong>Les d\u00e9veloppeurs ont souvent besoin de sauvegarder un instantan\u00e9 de leurs images ou conteneurs. Docker Build Export permet de cr\u00e9er une sauvegarde sans avoir besoin de s'appuyer sur un <span class=\"glossaryai-tooltip glossary-term-736\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-registry\/\" target=\"_blank\">Registre Docker<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Docker Registry is a storage and distribution system for Docker images. It allows developers to upload, manage, and share container images, facilitating efficient deployment in diverse environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-registry\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/p>\n<\/li>\n<li>\n<p><strong>Conformit\u00e9 et Audit<\/strong>: Some organizations require a record of which images were deployed and their contents. Exporting images provides a tangible artifact that can be archived and reviewed.<\/p>\n<\/li>\n<li>\n<p><strong>Optimisation des performances<\/strong>: Dans les cas o\u00f9 les utilisateurs travaillent avec de grandes images, l'exportation uniquement des calques qui ont \u00e9t\u00e9 modifi\u00e9s peut aider \u00e0 optimiser les performances des pipelines CI\/CD en minimisant la quantit\u00e9 de donn\u00e9es transf\u00e9r\u00e9es.<\/p>\n<\/li>\n<\/ol>\n<h2>How Docker Build Export Works<\/h2>\n<p>La commande Docker Build Export est principalement utilis\u00e9e avec la <code>docker build<\/code> command to output the constructed <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> in a tarball format. This tarball becomes a self-contained artifact 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\">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>, which can then be imported into another Docker host using the <code>docker load<\/code> commande.<\/p>\n<p>The basic syntax for exporting 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> looks like this:<\/p>\n<pre><code class=\"language-bash\">docker build --sortie  <\/code><\/pre>\n<p>O\u00f9 :<\/p>\n<ul>\n<li><code>`: C'est l\u00e0 que le fichier export\u00e9 sera sauvegard\u00e9. Cela peut \u00eatre un r\u00e9pertoire pour une exportation multi-fichiers ou un nom de fichier sp\u00e9cifique avec un<\/code>.Extension .tar`.<\/li>\n<li>&#8220;: The build context, typically a directory containing 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 other relevant files needed for the build.<\/li>\n<\/ul>\n<h3>Exemple de construction et d'exportation Docker<\/h3>\n<p>Let&#8217;s consider a practical example. Assume you have 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> that creates a simple web server <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> based on Nginx:<\/p>\n<pre><code class=\"language-Dockerfile\"># Dockerfile\nFROM nginx:alpine\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> .\/html \/usr\/share\/nginx\/html<\/code><\/pre>\n<p>You can build and export this <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> using the following command:<\/p>\n<pre><code class=\"language-bash\">docker build --output my-nginx-image.tar .<\/code><\/pre>\n<p>Cette commande cr\u00e9era une archive tar nomm\u00e9e <code>my-nginx-image.tar<\/code> dans le r\u00e9pertoire actuel, contenant les fichiers du serveur Nginx ainsi que vos fichiers HTML personnalis\u00e9s.<\/p>\n<h2>Key Features of Docker Build Export<\/h2>\n<h3>1. Prise en charge multi-architecture<\/h3>\n<p>Docker allows for building images that target multiple architectures (e.g., amd64, arm64). When exporting a multi-architecture <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 organizes the output tarball to reflect the structure, making it easier for deployments across different platforms.<\/p>\n<h3>2. Exporting Specific Layers<\/h3>\n<p>One of the intelligent features of Docker Build Export is that it allows you to control which layers are exported. By using specific flags when constructing 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\">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>, you can include or exclude certain layers based on your needs. This approach can be handy for debugging purposes or when you want to share only a specific part of 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\">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>.<\/p>\n<h3>3. Sortie compress\u00e9e<\/h3>\n<p>L'archive tar export\u00e9e peut \u00eatre compress\u00e9e pour \u00e9conomiser de l'espace. En utilisant les options de compression int\u00e9gr\u00e9es \u00e0 tar (comme gzip), vous pouvez r\u00e9duire consid\u00e9rablement la taille du fichier export\u00e9, ce qui facilite son transfert sur les r\u00e9seaux.<\/p>\n<h3>4. Integration with CI\/CD Pipelines<\/h3>\n<p>Docker Build Export can be seamlessly integrated into Continuous Integration and Continuous Deployment (CI\/CD) pipelines. By exporting images after successful builds, developers can automate the release process and ensure consistency across environments.<\/p>\n<h2>Common Use Cases for Docker Build Export<\/h2>\n<h3>1. Migrating Environments<\/h3>\n<p>When moving from one server to another or setting up a new environment, Docker Build Export allows you to ensure that the exact <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> used in production can be transferred and deployed without discrepancies.<\/p>\n<h3>2. Offline Deployment<\/h3>\n<p>Dans des sc\u00e9narios o\u00f9 <span class=\"glossaryai-tooltip glossary-term-661\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/network\/\" target=\"_blank\">r\u00e9seau<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A network, in computing, refers to a collection of interconnected devices that communicate and share resources. It enables data exchange, facilitates collaboration, and enhances operational efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/network\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Lorsque la connexion est limit\u00e9e ou inexistante, l'exportation des images peut permettre des d\u00e9ploiements hors ligne. Les d\u00e9veloppeurs peuvent exporter les images n\u00e9cessaires sur une cl\u00e9 USB et les importer sur la machine cible.<\/p>\n<h3>3. Archivage des images h\u00e9rit\u00e9es<\/h3>\n<p>For teams that maintain older versions of applications, exporting and archiving these Docker images ensures that they can be retrieved and deployed if needed in the future.<\/p>\n<h3>4. Working with Legacy Systems<\/h3>\n<p>In some cases, teams may be required to work with legacy systems that do not have direct access to a <span class=\"glossaryai-tooltip glossary-term-736\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-registry\/\" target=\"_blank\">Registre Docker<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Docker Registry is a storage and distribution system for Docker images. It allows developers to upload, manage, and share container images, facilitating efficient deployment in diverse environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-registry\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> or internet access. Building and exporting Docker images locally makes it possible to develop applications in such environments.<\/p>\n<h2>Limitations de l'exportation de la construction Docker<\/h2>\n<p>While Docker Build Export is a powerful tool, it does come with certain limitations:<\/p>\n<ul>\n<li>\n<p><strong>Large File Sizes<\/strong>: Exported images, especially those with many layers or substantial amounts of data, can result in large tar files. This could create challenges in environments with storage limitations.<\/p>\n<\/li>\n<li>\n<p><strong>Gestion des d\u00e9pendances<\/strong>: Exporting 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\">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> does not automatically resolve external dependencies (e.g., databases or other services). Users need to ensure that all necessary services are available in the target environment.<\/p>\n<\/li>\n<li>\n<p><strong>No Version History<\/strong>: Unlike Docker registries that maintain version histories, exporting images does not provide versioning. Users must manage versioning separately if they need to track multiple iterations of images.<\/p>\n<\/li>\n<\/ul>\n<h2>Best Practices for Using Docker Build Export<\/h2>\n<p>To make the most out of Docker Build Export, consider following these best practices:<\/p>\n<h3>Nettoyer avant l'exportation<\/h3>\n<p>Removing unnecessary files and dependencies from your 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> before exporting can help reduce the size of the exported tarball. Use <code>.dockerignore<\/code> files effectively to prevent unwanted files from being copied into 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>.<\/p>\n<h3>2. Use Tags Wisely<\/h3>\n<p>When exporting images, use meaningful tags to help identify versions easily. This practice becomes crucial when you have multiple artifacts in storage, making it simpler to manage and retrieve specific versions.<\/p>\n<h3>3. Test Exported Images<\/h3>\n<p>Before relying on an exported <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> for deployments, it&#8217;s advisable to test the import and execution 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\">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> in a staging environment. This testing helps identify any issues before they can affect production.<\/p>\n<h3>4. Document the Export Process<\/h3>\n<p>Le maintien d'une documentation sur la mani\u00e8re d'exporter et d'importer des images, ainsi que sur les indicateurs ou configurations sp\u00e9cifiques utilis\u00e9s, peut aider les membres de l'\u00e9quipe et les futurs d\u00e9veloppeurs \u00e0 comprendre le processus et \u00e0 maintenir la coh\u00e9rence.<\/p>\n<h3>5. Automatisez avec des scripts<\/h3>\n<p>Employing automation scripts to handle the export process can streamline workflows, especially in CI\/CD scenarios. Scripts can automate naming conventions, compression, and other repetitive tasks.<\/p>\n<h2>Conclusion<\/h2>\n<p>Docker Build Export is a fundamental aspect of the Docker ecosystem that empowers developers to manage their Docker images and containers effectively. By understanding its mechanics, use cases, and best practices, developers can leverage this command to enhance their workflows and ensure seamless application deployment.<\/p>\n<p>\u00c0 mesure que le paysage Docker \u00e9volue, la capacit\u00e9 d'exporter et de partager des images continuera de jouer un r\u00f4le crucial dans la mani\u00e8re dont les organisations construisent et d\u00e9ploient leurs applications. Ma\u00eetriser l'exportation de la construction Docker peut \u00eatre un atout inestimable, offrant la flexibilit\u00e9 et le contr\u00f4le n\u00e9cessaires dans le d\u00e9veloppement et les op\u00e9rations logicielles modernes.<\/p>","protected":false},"excerpt":{"rendered":"<p>Docker Build Export est une fonctionnalit\u00e9 qui permet aux utilisateurs d'exporter la sortie de construction, y compris <span class=\"glossaryai-tooltip glossary-term-739\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image-layers\/\" target=\"_blank\">couches d'image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Les calques sont des composants fondamentaux dans les logiciels de conception et d'\u00e9dition graphique, permettant une manipulation non destructive des \u00e9l\u00e9ments. Chaque calque peut contenir diff\u00e9rentes images, effets ou r\u00e9glages, offrant un contr\u00f4le pr\u00e9cis sur la composition et les effets visuels.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image-layers\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> et les m\u00e9tadonn\u00e9es, dans un r\u00e9pertoire ou une archive. Cela am\u00e9liore la portabilit\u00e9 et la reproductibilit\u00e9 des builds dans diff\u00e9rents environnements.<\/p>","protected":false},"author":1,"featured_media":1811,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1247","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>Docker Build Export - 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\/docker-build-export\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Build Export - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"Docker Build Export is a feature that allows users to export the build output, including image layers and metadata, into a directory or archive. This enhances build portability and reproducibility across environments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-build-export\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-23T12:21:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/\",\"name\":\"Docker Build Export - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg\",\"datePublished\":\"2024-07-23T12:16:15+00:00\",\"dateModified\":\"2024-07-23T12:21:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg\",\"width\":800,\"height\":600,\"caption\":\"docker-build-export-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#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\":\"Docker Build Export\"}]},{\"@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":"Docker Build Export - Dockerpros\n\nDocker Build Export is a command used to export the contents of a Docker image to a tar archive. This command is useful when you want to share an image with others or move it to a different system. The exported tar archive can be imported back into Docker using the docker load command.\n\nTo export a Docker image, you can use the following command:\n\n```\ndocker save -o  \n```\n\nThe `-o` flag specifies the output file where the exported image will be saved. Replace `` with the desired file name and `` with the name of the image you want to export.\n\nFor example, to export an image named \"my_image\" to a file called \"my_image.tar\", you can use the following command:\n\n```\ndocker save -o my_image.tar my_image\n```\n\nOnce the export is complete, you will have a tar archive containing the image. You can then share this archive with others or move it to a different system.\n\nTo import the exported image back into Docker, you can use the following command:\n\n```\ndocker load -i <input>\n```\n\nThe `-i` flag specifies the input file from which the image will be loaded. Replace `<input>` with the file name of the exported tar archive.\n\nFor example, to import the image from the \"my_image.tar\" file, you can use the following command:\n\n```\ndocker load -i my_image.tar\n```\n\nAfter importing the image, it will be available in your Docker environment and can be used like any other image.\n\nDocker Build Export is a powerful feature that allows you to easily share and move Docker images between different systems. It provides a convenient way to distribute images and ensures consistency across different environments.","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\/docker-build-export\/","og_locale":"fr_FR","og_type":"article","og_title":"Docker Build Export - Dockerpros","og_description":"Docker Build Export is a feature that allows users to export the build output, including image layers and metadata, into a directory or archive. This enhances build portability and reproducibility across environments.","og_url":"https:\/\/dockerpros.com\/fr\/wiki\/docker-build-export\/","og_site_name":"Dockerpros","article_modified_time":"2024-07-23T12:21:40+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/","url":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/","name":"Docker Build Export - Dockerpros\n\nDocker Build Export is a command used to export the contents of a Docker image to a tar archive. This command is useful when you want to share an image with others or move it to a different system. The exported tar archive can be imported back into Docker using the docker load command.\n\nTo export a Docker image, you can use the following command:\n\n```\ndocker save -o  \n```\n\nThe `-o` flag specifies the output file where the exported image will be saved. Replace `` with the desired file name and `` with the name of the image you want to export.\n\nFor example, to export an image named \"my_image\" to a file called \"my_image.tar\", you can use the following command:\n\n```\ndocker save -o my_image.tar my_image\n```\n\nOnce the export is complete, you will have a tar archive containing the image. You can then share this archive with others or move it to a different system.\n\nTo import the exported image back into Docker, you can use the following command:\n\n```\ndocker load -i <input>\n```\n\nThe `-i` flag specifies the input file from which the image will be loaded. Replace `<input>` with the file name of the exported tar archive.\n\nFor example, to import the image from the \"my_image.tar\" file, you can use the following command:\n\n```\ndocker load -i my_image.tar\n```\n\nAfter importing the image, it will be available in your Docker environment and can be used like any other image.\n\nDocker Build Export is a powerful feature that allows you to easily share and move Docker images between different systems. It provides a convenient way to distribute images and ensures consistency across different environments.","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg","datePublished":"2024-07-23T12:16:15+00:00","dateModified":"2024-07-23T12:21:40+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/docker-build-export\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-build-export_1247.jpg","width":800,"height":600,"caption":"docker-build-export-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/docker-build-export\/#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":"Docker Build Export"}]},{"@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\/1247","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\/1247\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media\/1811"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media?parent=1247"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary-cat?post=1247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}