{"id":1221,"date":"2024-07-22T20:46:32","date_gmt":"2024-07-22T20:46:32","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1221"},"modified":"2024-07-22T20:51:39","modified_gmt":"2024-07-22T20:51:39","slug":"docker-container-export","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/fr\/wiki\/docker-container-export\/","title":{"rendered":"Exportation de conteneur Docker"},"content":{"rendered":"<h1>Understanding Docker Container Export: An Advanced Overview<\/h1>\n<p>Docker has revolutionized the way developers build, package, and deploy applications. At the core of this technology lies the concept of containers\u2014lightweight, standalone, executable packages that include 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> software: code, runtime, system tools, libraries, and settings. Among the various functionalities Docker offers, the <code>docker export<\/code> command stands out as a powerful tool for saving the state of 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> into a tar archive. This article aims to provide an advanced understanding of the Docker <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> Export feature, exploring its intricacies, use cases, and best practices.<\/p>\n<h2>What is Docker Container Export?<\/h2>\n<p>The <code>docker export<\/code> command allows users to create a snapshot of a running or stopped container&#8217;s filesystem and save it as a tarball (.tar file). This tarball includes the complete file structure and contents of the <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>, excluding its metadata, such as environment variables, ports, and <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/volume\/\" target=\"_blank\">volume<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Volume is a quantitative measure of three-dimensional space occupied by an object or substance, typically expressed in cubic units. It is fundamental in fields such as physics, chemistry, and engineering.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/volume\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> configurations. Unlike <code>docker commit<\/code>, which creates a new <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> from a container\u2019s current state, <code>docker export<\/code> focuses solely on the filesystem content, making it ideal for scenarios where a lightweight, portable representation of the container\u2019s filesystem is required.<\/p>\n<h2>The Anatomy of Docker Containers<\/h2>\n<p>Before diving into the specifics of <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> export, it is vital to understand the anatomy of a Docker <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>. Each <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> is built from 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>, which is a layered filesystem containing the application code and dependencies. When 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> runs, it creates a writable layer on top of the <span class=\"glossaryai-tooltip glossary-term-739\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image-layers\/\" target=\"_blank\">image layers<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Image layers are fundamental components in graphic design and editing software, allowing for the non-destructive manipulation of elements. Each layer can contain different images, effects, or adjustments, enabling precise control over composition and visual effects.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image-layers\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. This writable layer captures all the changes made to the filesystem during the container\u2019s lifecycle.<\/p>\n<h3>Layers in Docker Images<\/h3>\n<p>Docker images are constructed in layers, with each layer representing a set of filesystem changes. These layers are immutable and shareable, allowing Docker to optimize storage and resource usage. When 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> writes data, it is stored in the top writable layer. The <code>docker export<\/code> command captures the contents of the writable layer along with the underlying <span class=\"glossaryai-tooltip glossary-term-739\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image-layers\/\" target=\"_blank\">image layers<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Image layers are fundamental components in graphic design and editing software, allowing for the non-destructive manipulation of elements. Each layer can contain different images, effects, or adjustments, enabling precise control over composition and visual effects.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/image-layers\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, combining them into a single tar archive.<\/p>\n<h3>Difference Between <code>docker export<\/code> and <code>docker commit<\/code><\/h3>\n<p>While both commands serve the purpose of capturing the state of 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>, they are fundamentally different in their approach and output:<\/p>\n<ul>\n<li>\n<p><strong><code>docker export<\/code><\/strong> generates a tarball of the container\u2019s filesystem without preserving any metadata. This makes it a suitable option when you need a snapshot that can be easily shared or archived but don\u2019t require any Docker-specific information.<\/p>\n<\/li>\n<li>\n<p><strong><code>docker commit<\/code><\/strong>, on the other hand, creates a new <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 retains the metadata and configuration options specified during the container&#8217;s runtime. This command is useful when you want to save the current state of 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> as a new <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 future replication or deployment.<\/p>\n<\/li>\n<\/ul>\n<h2>Use Cases for Docker Container Export<\/h2>\n<p>The <code>docker export<\/code> command has several practical applications in DevOps and software development processes. Here are a few notable use cases:<\/p>\n<h3>1. Migrating Containers Between Environments<\/h3>\n<p>When moving 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> from one environment to another\u2014like from development to production\u2014<code>docker export<\/code> can be used to export the container&#8217;s filesystem, which can then be imported into another Docker host using <code>docker import<\/code>. This is particularly useful in situations where the target environment does not have the same <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> readily available.<\/p>\n<h3>2. Creating Backups<\/h3>\n<p>For containers that hold critical data but do not require the entire configuration and environment settings, <code>docker export<\/code> allows users to create lightweight backups of the container\u2019s filesystem. This can be particularly beneficial for ephemeral containers that handle temporary data.<\/p>\n<h3>3. Examination of Container File Systems<\/h3>\n<p>In situations where debugging is necessary, or when a forensic analysis of a container&#8217;s filesystem is required, exporting the <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> can provide insights into its state at a particular moment in time. Analysts can unpack the tarball and inspect the contents, which can be invaluable for understanding the behavior of an application.<\/p>\n<h3>4. Sharing Container Filesystems<\/h3>\n<p>When collaborating with other developers or teams, sharing the state of a container&#8217;s filesystem can facilitate cooperation without the need for sharing the entire <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> or setting up specific Docker configurations. This can be particularly useful in open-source projects or during hackathons.<\/p>\n<h3>5. Container Versioning<\/h3>\n<p>While <code>docker commit<\/code> is typically used for versioning images, <code>docker export<\/code> can also play a role in version control by allowing teams to snapshot the current state of a container&#8217;s filesystem. This can serve as a reference point for future development or debugging efforts.<\/p>\n<h2>Using Docker Container Export<\/h2>\n<p>The syntax for the <code>docker export<\/code> command is straightforward:<\/p>\n<pre><code class=\"language-bash\">docker export [OPTIONS] <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><\/code><\/pre>\n<h3>Example Usage<\/h3>\n<p>To illustrate the command in action, let&#8217;s assume you have a running <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> named <code>my_container<\/code>. You can export this <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> to a tarball with the following command:<\/p>\n<pre><code class=\"language-bash\">docker export my_container &gt; my_container_export.tar<\/code><\/pre>\n<h3>Options for Docker Export<\/h3>\n<p>The <code>docker export<\/code> command includes a few options, though they are limited compared to other Docker commands. The primary option is:<\/p>\n<ul>\n<li><strong><code>--output<\/code> or <code>-o<\/code><\/strong>: This option allows you to specify the output file directly, rather than redirecting the output. Here\u2019s how to use it:<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">docker export --output=my_container_export.tar my_container<\/code><\/pre>\n<h2>Importing Exported Containers<\/h2>\n<p>Once you&#8217;ve exported 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>, you might want to import it back into Docker at some point. The corresponding command for this is <code>docker import<\/code>. The basic syntax for importing a tarball is:<\/p>\n<pre><code class=\"language-bash\">docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]<\/code><\/pre>\n<h3>Example of Importing<\/h3>\n<p>To import the tarball we created earlier, you would use:<\/p>\n<pre><code class=\"language-bash\">docker import my_container_export.tar my_new_image<\/code><\/pre>\n<p>This command creates a new <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> called <code>my_new_image<\/code> from the filesystem contained in <code>my_container_export.tar<\/code>.<\/p>\n<h2>Best Practices for Docker Container Export<\/h2>\n<p>While using <code>docker export<\/code> can be straightforward, adhering to best practices ensures that you get the most out of this functionality:<\/p>\n<h3>1. Understand the Limitations<\/h3>\n<p>Be aware that <code>docker export<\/code> does not include any of the container&#8217;s metadata, such as environment variables, <span class=\"glossaryai-tooltip glossary-term-677\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/port\/\" target=\"_blank\">port<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A PORT is a communication endpoint in a computer network, defined by a numerical identifier. It facilitates the routing of data to specific applications, enhancing system functionality and security.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/port\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> mappings, or <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/volume\/\" target=\"_blank\">volume<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Volume is a quantitative measure of three-dimensional space occupied by an object or substance, typically expressed in cubic units. It is fundamental in fields such as physics, chemistry, and engineering.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/volume\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> information. If you require a complete environment setup, consider using <code>docker commit<\/code> instead.<\/p>\n<h3>2. Use for Lightweight Backups<\/h3>\n<p>When creating backups, use <code>docker export<\/code> for its lightweight nature. However, ensure that other configurations and metadata are documented elsewhere if needed for restoration.<\/p>\n<h3>3. Clean Up Before Exporting<\/h3>\n<p>If you plan to export 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>, consider cleaning up unnecessary files or data within the filesystem. This can significantly reduce the size of the exported tarball and make it easier to manage.<\/p>\n<h3>4. Maintain Naming Conventions<\/h3>\n<p>When exporting and importing containers, maintain a consistent naming convention for your tarballs and images. This practice aids organization and minimizes confusion when working with multiple containers.<\/p>\n<h3>5. Automate Export Processes<\/h3>\n<p>For production environments, automating the export process using scripts or CI\/CD pipelines can enhance efficiency and reduce human error. This can ensure that regular backups or snapshots are taken without manual intervention.<\/p>\n<h2>Conclusion<\/h2>\n<p>The <code>docker export<\/code> command serves as a crucial tool in the Docker ecosystem, providing developers and system administrators with the ability to create snapshots of <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> filesystems in a flexible and portable manner. By understanding its features, limitations, and best practices, users can effectively leverage this command in various scenarios, from debugging and backup creation to environment migration and <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> sharing.<\/p>\n<p>As the landscape of containerization continues to evolve, mastering the nuances of commands like <code>docker export<\/code> will empower teams to manage their applications more effectively, ensuring seamless development and operational efficiencies. Whether you are an experienced Docker user or just starting, understanding the power of exporting containers is a valuable addition to your toolkit.<\/p>","protected":false},"excerpt":{"rendered":"<p>Docker <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> L'export permet aux utilisateurs de cr\u00e9er une archive tar du syst\u00e8me de fichiers d'un conteneur, facilitant ainsi sa portabilit\u00e9 et sa sauvegarde. Ce processus capture l'\u00e9tat actuel, en excluant les m\u00e9tadonn\u00e9es et les volumes.<\/p>","protected":false},"author":1,"featured_media":1759,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1221","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 Container 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-container-export\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Container Export - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"Docker Container Export allows users to create a tarball of a container&#039;s filesystem, facilitating portability and backup. This process captures the current state, excluding metadata and volumes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-container-export\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-22T20:51:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.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-container-export\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/docker-container-export\/\",\"name\":\"Docker Container Export - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.jpg\",\"datePublished\":\"2024-07-22T20:46:32+00:00\",\"dateModified\":\"2024-07-22T20:51:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/docker-container-export\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.jpg\",\"width\":800,\"height\":600,\"caption\":\"docker-container-export-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-container-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 Container 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":"Export de conteneur Docker - Dockerpros","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dockerpros.com\/fr\/wiki\/docker-container-export\/","og_locale":"fr_FR","og_type":"article","og_title":"Docker Container Export - Dockerpros","og_description":"Docker Container Export allows users to create a tarball of a container's filesystem, facilitating portability and backup. This process captures the current state, excluding metadata and volumes.","og_url":"https:\/\/dockerpros.com\/fr\/wiki\/docker-container-export\/","og_site_name":"Dockerpros","article_modified_time":"2024-07-22T20:51:39+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.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-container-export\/","url":"https:\/\/dockerpros.com\/wiki\/docker-container-export\/","name":"Export de conteneur Docker - Dockerpros","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.jpg","datePublished":"2024-07-22T20:46:32+00:00","dateModified":"2024-07-22T20:51:39+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/docker-container-export\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/wiki\/docker-container-export\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-container-export_1221.jpg","width":800,"height":600,"caption":"docker-container-export-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/docker-container-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 Container 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\/1221","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\/1221\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media\/1759"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media?parent=1221"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary-cat?post=1221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}