{"id":1196,"date":"2024-07-22T20:45:32","date_gmt":"2024-07-22T20:45:32","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1196"},"modified":"2024-07-22T20:51:28","modified_gmt":"2024-07-22T20:51:28","slug":"docker-compose-remove","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose-remove\/","title":{"rendered":"Docker Compose Supprimer"},"content":{"rendered":"<h1>Understanding Docker Compose Remove: A Comprehensive Guide<\/h1>\n<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is a powerful tool that simplifies the management of multi-container Docker applications. It allows users to define the application&#8217;s services, networks, and volumes in a <span class=\"glossaryai-tooltip glossary-term-690\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/yaml\/\" target=\"_blank\">YAML<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">YAML (YAML Ain't Markup Language) is a human-readable data serialization format commonly used for configuration files. It emphasizes simplicity and clarity, making it suitable for both developers and non-developers.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/yaml\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> file, making it easier to deploy and maintain complex environments. One of the essential commands within <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is <code>docker-compose down<\/code>, which is used to remove containers, networks, volumes, and images created by the <code>docker-compose up<\/code> command. This article delves into the nuances of the <code>docker-compose down<\/code> command, including its options, best practices, and implications for <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> management.<\/p>\n<h2>Overview of Docker Compose<\/h2>\n<p>Before diving into the specifics of <code>docker-compose down<\/code>, it&#8217;s essential to understand the broader context of <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> provides a way to define and <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> multi-container Docker applications. Using the <code>docker-compose.yml<\/code> file, developers can specify the services needed for their application, including their configuration settings, environment variables, and dependencies.<\/p>\n<h3>Basic Structure of a Docker Compose File<\/h3>\n<p>A typical <code>docker-compose.yml<\/code> file includes several key sections:<\/p>\n<ul>\n<li><strong>version<\/strong>: Specifies the Compose file format version.<\/li>\n<li><strong>services<\/strong>: Defines the various services (containers) that make up the application.<\/li>\n<li><strong>networks<\/strong>: Configures custom networks for communication between containers.<\/li>\n<li><strong>volumes<\/strong>: Manages persistent data storage for containers.<\/li>\n<\/ul>\n<p>Here\u2019s a simple example of a <code>docker-compose.yml<\/code> file:<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\nservices:\n  web:\n    image: nginx:latest\n    ports:\n      - \"80:80\"\n  db:\n    <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>: postgres:latest\n    environment:\n      POSTGRES_DB: exampledb\n      POSTGRES_USER: user\n      POSTGRES_PASSWORD: password<\/code><\/pre>\n<p>This example defines two services: a web server using Nginx and a database server using PostgreSQL.<\/p>\n<h2>The Role of <code>docker-compose down<\/code><\/h2>\n<p>The <code>docker-compose down<\/code> command is a critical component of <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, used to stop and remove all services defined in the <code>docker-compose.yml<\/code> file. Unlike <code>docker-compose stop<\/code>, which only stops the running containers, <code>docker-compose down<\/code> removes the containers, networks, and optionally the volumes and images created by the <code>up<\/code> command.<\/p>\n<h3>Command Syntax and Options<\/h3>\n<p>The basic syntax of the <code>docker-compose down<\/code> command is as follows:<\/p>\n<pre><code class=\"language-bash\">docker-compose down [OPTIONS]<\/code><\/pre>\n<p>Here are some useful options that you can use with <code>docker-compose down<\/code>:<\/p>\n<ul>\n<li><code>--volumes<\/code> or <code>-v<\/code>: Remove named volumes declared in the <code>volumes<\/code> section of the Compose file.<\/li>\n<li><code>--rmi<\/code> {all, local}: Remove images used by any <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. The <code>all<\/code> option removes all images, while <code>local<\/code> removes images that are built locally.<\/li>\n<li><code>--remove-orphans<\/code>: Remove containers for services not defined in the <code>docker-compose.yml<\/code> file.<\/li>\n<\/ul>\n<h3>Example Use Case<\/h3>\n<p>Let\u2019s consider an example where you have a web application running with both a frontend and backend <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. After testing and development, you might want to clean up your environment. Running the following command will stop and remove all services, networks, and optionally volumes.<\/p>\n<pre><code class=\"language-bash\">docker-compose down --volumes<\/code><\/pre>\n<p>This command effectively resets your Docker environment, ensuring you can start fresh for the next iteration of development or testing.<\/p>\n<h2>Why Use <code>docker-compose down<\/code>?<\/h2>\n<p>The primary purpose of <code>docker-compose down<\/code> is to facilitate the cleanup of resources that are no longer needed. Here are several reasons why you might choose to use this command:<\/p>\n<ol>\n<li><strong>Resource Management<\/strong>: Running multiple containers can consume significant system resources. Stopping and removing them frees up CPU, memory, and disk space.<\/li>\n<li><strong>Environment Reset<\/strong>: If you\u2019re in a development phase and want to ensure that you\u2019re starting with a clean slate, using <code>docker-compose down<\/code> allows you to reset your environment quickly.<\/li>\n<li><strong>Simplifying Testing<\/strong>: For developers writing tests for their applications, it\u2019s essential to ensure tests <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> in a consistent and isolated environment. Using <code>docker-compose down<\/code> helps achieve this by removing any leftover state from previous runs.<\/li>\n<li><strong>Orphan Management<\/strong>: Over time, you may <span class=\"glossaryai-tooltip glossary-term-674\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/add\/\" target=\"_blank\">add<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The ADD instruction in Docker is a command used in Dockerfiles to copy files and directories from a host machine into a Docker image during the build process. It not only facilitates the transfer of local files but also provides additional functionality, such as automatically extracting compressed files and fetching remote files via HTTP or HTTPS.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/add\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> or remove services from your <code>docker-compose.yml<\/code> file. The <code>--remove-orphans<\/code> flag can help keep your environment tidy by removing containers for services that are no longer defined in the file.<\/li>\n<\/ol>\n<h2>Best Practices for Using <code>docker-compose down<\/code><\/h2>\n<p>While using <code>docker-compose down<\/code> is straightforward, there are specific best practices you should consider to optimize its use:<\/p>\n<h3>1. Use with Caution<\/h3>\n<p>Before executing <code>docker-compose down<\/code>, ensure that you have saved any necessary data. If you remove volumes with the <code>--volumes<\/code> option, you will permanently lose any data stored in those volumes unless you\u2019ve backed it up elsewhere.<\/p>\n<h3>2. Be Strategic with Volumes<\/h3>\n<p>If your application requires persistent data, consider separating the <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> removal from 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> removal. Use <code>docker-compose down<\/code> without the <code>--volumes<\/code> option, and then manage <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> cleanup separately as needed.<\/p>\n<h3>3. Monitor Dependencies<\/h3>\n<p>When removing services, be mindful of <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> dependencies. If your application relies on inter-service communication, ensure that you properly manage these dependencies to avoid disrupting <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> availability.<\/p>\n<h3>4. Use Profiles for Different Environments<\/h3>\n<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> v2 introduced the concept of profiles, allowing you to define different <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> configurations for various environments (development, testing, production). Use profiles to streamline your setup and teardown processes.<\/p>\n<h3>5. Automate Cleanup in CI\/CD Pipelines<\/h3>\n<p>In Continuous Integration\/Continuous Deployment (CI\/CD) pipelines, it\u2019s crucial to ensure a clean environment for each build. Incorporate <code>docker-compose down<\/code> as part of your cleanup script to ensure that stale containers do not affect future builds.<\/p>\n<h2>Troubleshooting Common Issues<\/h2>\n<p>While <code>docker-compose down<\/code> is generally reliable, you may encounter some issues. Here are some common problems and their solutions:<\/p>\n<h3>1. Containers Won&#8217;t Stop<\/h3>\n<p>If you find that containers are not stopping as expected, you can use the <code>docker-compose stop<\/code> command to force-stop the containers before running <code>docker-compose down<\/code>.<\/p>\n<h3>2. Volumes Still Exist<\/h3>\n<p>If you <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <code>docker-compose down<\/code> without the <code>--volumes<\/code> option and notice that volumes still exist, remember that this is by design. Use <code><span class=\"glossaryai-tooltip glossary-term-1171\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-volume-ls\/\" target=\"_blank\">docker volume ls<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The `docker volume ls` command lists all Docker volumes on the host. This command helps users to manage persistent data storage efficiently, providing essential details like volume name and driver.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-volume-ls\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/code> to inspect existing volumes.<\/p>\n<h3>3. Orphan Containers Persisting<\/h3>\n<p>If orphaned containers remain after running <code>docker-compose down<\/code>, ensure you have included the <code>--remove-orphans<\/code> flag. This will help clean up any containers for services no longer defined.<\/p>\n<h2>Conclusion<\/h2>\n<p>The <code>docker-compose down<\/code> command is an indispensable tool for managing Docker containers in a multi-service environment. Understanding its functionality and best practices can significantly enhance your workflow, allowing you to efficiently manage resources, maintain clean environments, and streamline development processes. Whether you are a beginner or a seasoned Docker user, mastering <code>docker-compose down<\/code> will play a crucial role in your <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> management strategy.<\/p>\n<p>As Docker technology continues to evolve, staying informed about best practices and command usage will ensure that you can leverage Docker Compose&#8217;s full capabilities. The cleaner and more organized your development environment, the more productive and efficient your workflows will become.<\/p>","protected":false},"excerpt":{"rendered":"<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Remove est une commande utilis\u00e9e pour arr\u00eater et supprimer les conteneurs d\u00e9finis dans un fichier Compose. Elle simplifie le processus de nettoyage en g\u00e9rant efficacement <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> lifecycles while maintaining project organization.<\/p>","protected":false},"author":1,"featured_media":1709,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1196","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 Compose Remove - 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-compose-remove\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Compose Remove - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"Docker Compose Remove is a command used to stop and remove containers defined in a Compose file. It simplifies the cleanup process by efficiently managing container lifecycles while maintaining project organization.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose-remove\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-22T20:51:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/\",\"name\":\"Docker Compose Remove - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg\",\"datePublished\":\"2024-07-22T20:45:32+00:00\",\"dateModified\":\"2024-07-22T20:51:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg\",\"width\":800,\"height\":600,\"caption\":\"docker-compose-remove-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#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 Compose Remove\"}]},{\"@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":"Supprimer Docker Compose - Dockerpros\n\nDocker Compose est un outil puissant qui permet de d\u00e9finir et d'ex\u00e9cuter des applications multi-conteneurs. Cependant, il peut arriver que vous ayez besoin de supprimer des conteneurs, des r\u00e9seaux ou des volumes cr\u00e9\u00e9s par Docker Compose. Dans cet article, nous allons explorer les diff\u00e9rentes fa\u00e7ons de supprimer des ressources Docker Compose.\n\n1. Supprimer des conteneurs\n\nPour supprimer des conteneurs cr\u00e9\u00e9s par Docker Compose, vous pouvez utiliser la commande suivante :\n\n```\ndocker-compose down\n```\n\nCette commande arr\u00eatera et supprimera tous les conteneurs d\u00e9finis dans votre fichier docker-compose.yml. Elle supprimera \u00e9galement les r\u00e9seaux et les volumes associ\u00e9s, sauf si vous utilisez l'option --volumes.\n\n2. Supprimer des conteneurs et des volumes\n\nSi vous souhaitez supprimer les conteneurs ainsi que les volumes associ\u00e9s, vous pouvez utiliser l'option --volumes :\n\n```\ndocker-compose down --volumes\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les volumes cr\u00e9\u00e9s par Docker Compose.\n\n3. Supprimer des conteneurs et des images\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images utilis\u00e9es par ces conteneurs, vous pouvez utiliser l'option --rmi :\n\n```\ndocker-compose down --rmi all\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images utilis\u00e9es par les conteneurs.\n\n4. Supprimer des conteneurs et des images non tagu\u00e9es\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images non tagu\u00e9es utilis\u00e9es par ces conteneurs, vous pouvez utiliser l'option --rmi avec l'argument local :\n\n```\ndocker-compose down --rmi local\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images non tagu\u00e9es utilis\u00e9es par les conteneurs.\n\n5. Supprimer des conteneurs et des images avec une confirmation\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images utilis\u00e9es par ces conteneurs, mais que vous voulez \u00eatre invit\u00e9 \u00e0 confirmer chaque suppression, vous pouvez utiliser l'option --rmi avec l'argument prompt :\n\n```\ndocker-compose down --rmi prompt\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images utilis\u00e9es par les conteneurs, mais vous demandera de confirmer chaque suppression.\n\n6. Supprimer des conteneurs et des images avec une confirmation et une suppression forc\u00e9e\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images utilis\u00e9es par ces conteneurs, mais que vous voulez \u00eatre invit\u00e9 \u00e0 confirmer chaque suppression et que vous voulez forcer la suppression m\u00eame si les conteneurs sont en cours d'ex\u00e9cution, vous pouvez utiliser l'option --rmi avec l'argument prompt et l'option --force :\n\n```\ndocker-compose down --rmi prompt --force\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images utilis\u00e9es par les conteneurs, mais vous demandera de confirmer chaque suppression et forcera la suppression m\u00eame si les conteneurs sont en cours d'ex\u00e9cution.\n\nEn conclusion, Docker Compose offre plusieurs options pour supprimer des ressources telles que les conteneurs, les r\u00e9seaux et les volumes. Vous pouvez choisir l'option qui correspond le mieux \u00e0 vos besoins en fonction de ce que vous souhaitez supprimer.","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-compose-remove\/","og_locale":"fr_FR","og_type":"article","og_title":"Docker Compose Remove - Dockerpros","og_description":"Docker Compose Remove is a command used to stop and remove containers defined in a Compose file. It simplifies the cleanup process by efficiently managing container lifecycles while maintaining project organization.","og_url":"https:\/\/dockerpros.com\/fr\/wiki\/docker-compose-remove\/","og_site_name":"Dockerpros","article_modified_time":"2024-07-22T20:51:28+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/","url":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/","name":"Supprimer Docker Compose - Dockerpros\n\nDocker Compose est un outil puissant qui permet de d\u00e9finir et d'ex\u00e9cuter des applications multi-conteneurs. Cependant, il peut arriver que vous ayez besoin de supprimer des conteneurs, des r\u00e9seaux ou des volumes cr\u00e9\u00e9s par Docker Compose. Dans cet article, nous allons explorer les diff\u00e9rentes fa\u00e7ons de supprimer des ressources Docker Compose.\n\n1. Supprimer des conteneurs\n\nPour supprimer des conteneurs cr\u00e9\u00e9s par Docker Compose, vous pouvez utiliser la commande suivante :\n\n```\ndocker-compose down\n```\n\nCette commande arr\u00eatera et supprimera tous les conteneurs d\u00e9finis dans votre fichier docker-compose.yml. Elle supprimera \u00e9galement les r\u00e9seaux et les volumes associ\u00e9s, sauf si vous utilisez l'option --volumes.\n\n2. Supprimer des conteneurs et des volumes\n\nSi vous souhaitez supprimer les conteneurs ainsi que les volumes associ\u00e9s, vous pouvez utiliser l'option --volumes :\n\n```\ndocker-compose down --volumes\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les volumes cr\u00e9\u00e9s par Docker Compose.\n\n3. Supprimer des conteneurs et des images\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images utilis\u00e9es par ces conteneurs, vous pouvez utiliser l'option --rmi :\n\n```\ndocker-compose down --rmi all\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images utilis\u00e9es par les conteneurs.\n\n4. Supprimer des conteneurs et des images non tagu\u00e9es\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images non tagu\u00e9es utilis\u00e9es par ces conteneurs, vous pouvez utiliser l'option --rmi avec l'argument local :\n\n```\ndocker-compose down --rmi local\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images non tagu\u00e9es utilis\u00e9es par les conteneurs.\n\n5. Supprimer des conteneurs et des images avec une confirmation\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images utilis\u00e9es par ces conteneurs, mais que vous voulez \u00eatre invit\u00e9 \u00e0 confirmer chaque suppression, vous pouvez utiliser l'option --rmi avec l'argument prompt :\n\n```\ndocker-compose down --rmi prompt\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images utilis\u00e9es par les conteneurs, mais vous demandera de confirmer chaque suppression.\n\n6. Supprimer des conteneurs et des images avec une confirmation et une suppression forc\u00e9e\n\nSi vous souhaitez supprimer les conteneurs ainsi que les images utilis\u00e9es par ces conteneurs, mais que vous voulez \u00eatre invit\u00e9 \u00e0 confirmer chaque suppression et que vous voulez forcer la suppression m\u00eame si les conteneurs sont en cours d'ex\u00e9cution, vous pouvez utiliser l'option --rmi avec l'argument prompt et l'option --force :\n\n```\ndocker-compose down --rmi prompt --force\n```\n\nCette commande supprimera les conteneurs, les r\u00e9seaux et les images utilis\u00e9es par les conteneurs, mais vous demandera de confirmer chaque suppression et forcera la suppression m\u00eame si les conteneurs sont en cours d'ex\u00e9cution.\n\nEn conclusion, Docker Compose offre plusieurs options pour supprimer des ressources telles que les conteneurs, les r\u00e9seaux et les volumes. Vous pouvez choisir l'option qui correspond le mieux \u00e0 vos besoins en fonction de ce que vous souhaitez supprimer.","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg","datePublished":"2024-07-22T20:45:32+00:00","dateModified":"2024-07-22T20:51:28+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-remove_1196.jpg","width":800,"height":600,"caption":"docker-compose-remove-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-remove\/#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 Compose Remove"}]},{"@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\/1196","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\/1196\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media\/1709"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/media?parent=1196"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/fr\/wp-json\/wp\/v2\/glossary-cat?post=1196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}