{"id":1183,"date":"2024-07-22T20:45:20","date_gmt":"2024-07-22T20:45:20","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1183"},"modified":"2024-07-22T20:51:16","modified_gmt":"2024-07-22T20:51:16","slug":"docker-compose-down","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-down\/","title":{"rendered":"Docker Compose herunterfahren"},"content":{"rendered":"<h1>Understanding Docker Compose Down: A Deep Dive<\/h1>\n<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is a powerful tool that simplifies the management of multi-container applications. It allows developers to define and <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> applications composed of multiple services in a single <span class=\"glossaryai-tooltip glossary-term-690\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/yaml\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> file. One of the core commands in <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is <code>docker-compose down<\/code>, which provides a simple yet effective way to stop and remove all running containers defined in the <code>docker-compose.yml<\/code> file. This article delves into the functionality, use cases, options, and best practices surrounding the <code>docker-compose down<\/code> command, helping you to understand its importance in the Docker ecosystem.<\/p>\n<h2>The Role of Docker Compose in Container Orchestration<\/h2>\n<p>Before we dive into <code>docker-compose down<\/code>, it\u2019s essential to understand the broader context of <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. Docker itself is focused on single-container management, whereas <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> caters to applications that require multiple interconnected containers. This is particularly useful in microservices architecture, where each <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> can <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in its <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, enabling scalability and isolation.<\/p>\n<p>With <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, developers can define services, networks, and volumes in a declarative manner using a <code>docker-compose.yml<\/code> file. This file serves as a blueprint for creating and managing a multi-container application, allowing you to start up an entire application <span class=\"glossaryai-tooltip glossary-term-682\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/stack\/\" target=\"_blank\">stack<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A stack is a data structure that operates on a Last In, First Out (LIFO) principle, where the most recently added element is the first to be removed. It supports two primary operations: push and pop.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/stack\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> with a single command.<\/p>\n<h2>The <code>docker-compose down<\/code> Command Explained<\/h2>\n<p>The <code>docker-compose down<\/code> command is used to stop and remove all containers defined in your <code>docker-compose.yml<\/code> file. When executed, this command performs three main actions:<\/p>\n<ol>\n<li><strong>Stops Running Containers<\/strong>: All containers started by the <code>docker-compose up<\/code> command are stopped.<\/li>\n<li><strong>Removes Containers<\/strong>: Once stopped, the containers are also removed from the host system.<\/li>\n<li><strong>Removes Networks<\/strong>: If no other services are using them, the networks created for the application are deleted.<\/li>\n<\/ol>\n<h3>Basic Syntax and Usage<\/h3>\n<p>The basic syntax of the <code>docker-compose down<\/code> command is straightforward:<\/p>\n<pre><code class=\"language-bash\">docker-compose down [OPTIONS]<\/code><\/pre>\n<ul>\n<li><strong>OPTIONS<\/strong>: Various options can be specified to customize the behavior of the command.<\/li>\n<\/ul>\n<h3>Example Usage<\/h3>\n<p>To illustrate the <code>docker-compose down<\/code> command in action, let&#8217;s consider a simple <code>docker-compose.yml<\/code> file that defines a web application with a database <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\nservices:\n  web:\n    image: nginx\n    ports:\n      - \"8080:80\"\n  db:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: postgres\n    environment:\n      POSTGRES_USER: user\n      POSTGRES_PASSWORD: password<\/code><\/pre>\n<p>To start the application, you would <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-bash\">docker-compose up -d<\/code><\/pre>\n<p>This command runs the services in detached mode. To stop and remove these services, along with any associated networks, you would use:<\/p>\n<pre><code class=\"language-bash\">docker-compose down<\/code><\/pre>\n<h2>Options Available with <code>docker-compose down<\/code><\/h2>\n<p>The <code>docker-compose down<\/code> command comes with several options that modify its behavior. Understanding these options enables you to utilize the command more effectively in different scenarios.<\/p>\n<h3><code>--volumes<\/code> or <code>-v<\/code><\/h3>\n<p>This option allows you to remove named volumes declared in the <code>volumes<\/code> section of the <code>docker-compose.yml<\/code> file. By default, <code>docker-compose down<\/code> will not remove volumes, which can be useful for persisting data across <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> restarts. However, if you no longer need the data, you can <span class=\"glossaryai-tooltip glossary-term-674\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/add\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> the <code>-v<\/code> or <code>--volumes<\/code> flag:<\/p>\n<pre><code class=\"language-bash\">docker-compose down -v<\/code><\/pre>\n<h3><code>--remove-orphans<\/code><\/h3>\n<p>Using this option will remove containers for services that are not defined in the <code>docker-compose.yml<\/code> file. This is particularly useful when you have modified the configuration, and leftover containers from previous setups could cause conflicts.<\/p>\n<pre><code class=\"language-bash\">docker-compose down --remove-orphans<\/code><\/pre>\n<h3><code>--timeout<\/code><\/h3>\n<p>This option allows you to specify a grace period (in seconds) for how long to wait for containers to stop before forcefully terminating them. This is essential in scenarios where containers might not shut down cleanly:<\/p>\n<pre><code class=\"language-bash\">docker-compose down --timeout 30<\/code><\/pre>\n<h2>Why Use <code>docker-compose down<\/code>?<\/h2>\n<p>While it might seem simple, there are several compelling reasons to use <code>docker-compose down<\/code> effectively.<\/p>\n<h3>Resource Management<\/h3>\n<p>When developing and testing applications, especially with multiple services, it&#8217;s common to leave containers running to save time. However, this can lead to resource exhaustion on your machine. Using <code>docker-compose down<\/code> to stop and remove these containers ensures that you are not overloading your system with inactive services.<\/p>\n<h3>Clean Environment for Testing<\/h3>\n<p>In a development environment, you may frequently change your <code>docker-compose.yml<\/code> file. Using <code>docker-compose down<\/code> allows you to cleanly reset your environment before applying new configurations. This practice helps avoid conflicts or unexpected behavior caused by leftover containers or networks.<\/p>\n<h3>Integration with CI\/CD Pipelines<\/h3>\n<p>In continuous integration and continuous deployment (CI\/CD) pipelines, it is essential to have a clean state for each build. Using <code>docker-compose down<\/code> within your CI\/CD scripts ensures that previous builds do not interfere with the current one, providing a reliable testing environment.<\/p>\n<h2>Best Practices for Using <code>docker-compose down<\/code><\/h2>\n<p>To maximize the benefits of the <code>docker-compose down<\/code> command, adhere to these best practices:<\/p>\n<h3>Use Version Control for <code>docker-compose.yml<\/code><\/h3>\n<p>Maintaining version control for your <code>docker-compose.yml<\/code> file is vital. This allows you to track changes and revert to previous configurations if necessary. If you have to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <code>docker-compose down<\/code>, you want to ensure that you can easily bring back the same setup later.<\/p>\n<h3>Regularly Clean Up Unused Volumes<\/h3>\n<p>If you frequently use the <code>-v<\/code> option with <code>docker-compose down<\/code>, consider regularly cleaning up unused volumes that may accumulate over time. You can do this using:<\/p>\n<pre><code class=\"language-bash\"><span class=\"glossaryai-tooltip glossary-term-1172\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-volume-prune\/\" target=\"_blank\">docker volume prune<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Volume Prune is a command used to remove all unused volumes from your system. This helps manage disk space efficiently by eliminating orphaned data that is no longer associated with any container.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-volume-prune\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/code><\/pre>\n<p>This command will remove all unused volumes from the Docker host.<\/p>\n<h3>Monitor Resource Usage<\/h3>\n<p>Use commands like <code>docker stats<\/code> to monitor the resource usage of your containers. Regularly stopping and removing containers can help manage resource utilization effectively.<\/p>\n<h3>Document Container Dependencies<\/h3>\n<p>If your application <span class=\"glossaryai-tooltip glossary-term-682\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/stack\/\" target=\"_blank\">stack<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A stack is a data structure that operates on a Last In, First Out (LIFO) principle, where the most recently added element is the first to be removed. It supports two primary operations: push and pop.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/stack\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> grows in complexity, document the dependencies and configurations of your services. This ensures that when you <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <code>docker-compose down<\/code>, you can quickly restore your <span class=\"glossaryai-tooltip glossary-term-682\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/stack\/\" target=\"_blank\">stack<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A stack is a data structure that operates on a Last In, First Out (LIFO) principle, where the most recently added element is the first to be removed. It supports two primary operations: push and pop.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/stack\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> without confusion.<\/p>\n<h2>Scenarios Where <code>docker-compose down<\/code> Is Essential<\/h2>\n<p>Understanding when to use <code>docker-compose down<\/code> can make a significant difference in your development workflow. Below are scenarios where this command is particularly useful:<\/p>\n<h3>Development Iterations<\/h3>\n<p>When developing an application, you may find yourself making frequent changes to the code or configuration. Running <code>docker-compose down<\/code> before each build can help ensure that you are testing against the latest version of your application without interference from previous states.<\/p>\n<h3>Cleanup After Testing<\/h3>\n<p>After running automated tests in a CI\/CD pipeline, it is essential to clean up resources. Incorporating <code>docker-compose down<\/code> into your testing pipeline helps ensure that all resources are properly disposed of after the tests have been completed.<\/p>\n<h3>Environment Migration<\/h3>\n<p>When migrating from one environment to another, such as from development to staging, using <code>docker-compose down<\/code> helps ensure that the new environment starts cleanly without any remnants of the previous setup.<\/p>\n<h2>Common Issues and Troubleshooting<\/h2>\n<p>Despite its simplicity, users may encounter issues when using <code>docker-compose down<\/code>. Here are some common problems and their solutions:<\/p>\n<h3>Containers Not Stopping<\/h3>\n<p>One of the frequent issues users face is containers not stopping as expected. This could be due to processes inside the containers that do not respond to the stop signal. To troubleshoot, identify the problematic <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> and check its logs using:<\/p>\n<pre><code class=\"language-bash\">docker-compose logs <\/code><\/pre>\n<h3>Orphan Containers Still Running<\/h3>\n<p>If you notice containers that should have been removed still running, ensure you are using the <code>--remove-orphans<\/code> option. You can also list all running containers and identify any orphaned ones using:<\/p>\n<pre><code class=\"language-bash\">docker ps<\/code><\/pre>\n<h3>Volume Persistence Unexpected<\/h3>\n<p>Sometimes, you may expect volumes to be removed with <code>docker-compose down -v<\/code>, but they persist. This can happen if you have other containers using the same <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/volume\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. Check for any dependencies that may cause this behavior.<\/p>\n<h2>Conclusion<\/h2>\n<p>The <code>docker-compose down<\/code> command is a fundamental tool in the Docker ecosystem, enabling developers to efficiently manage multi-container applications. By understanding its functionality, options, and best practices, you can leverage this command to maintain a clean and organized development environment. Whether you&#8217;re iterating on an application, managing resources, or streamlining CI\/CD processes, <code>docker-compose down<\/code> plays a crucial role in ensuring that your containerized applications <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> smoothly and efficiently.<\/p>\n<p>In the world of Docker, where <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\/de\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <span class=\"glossaryai-tooltip glossary-term-657\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/orchestration\/\" target=\"_blank\">orchestration<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Orchestration refers to the automated management and coordination of complex systems and services. It optimizes processes by integrating various components, ensuring efficient operation and resource utilization.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/orchestration\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is vital, mastering commands like <code>docker-compose down<\/code> is essential for developers and system administrators. By integrating this command into your workflows, you can enhance your productivity and ensure that your applications are always running in an optimal environment.<\/p>","protected":false},"excerpt":{"rendered":"<p>Der Befehl `docker-compose down` wird verwendet, um die in einer Docker Compose-Konfiguration definierten Container zu stoppen und zu entfernen. <span class=\"glossaryai-tooltip glossary-term-689\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-file\/\" target=\"_blank\">Docker Compose-Datei<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Eine Docker Compose-Datei ist eine YAML-Konfigurationsdatei, die Dienste, Netzwerke und Volumes f\u00fcr Docker-Anwendungen mit mehreren Containern definiert. Sie vereinfacht die Bereitstellung und Verwaltung und erh\u00f6ht die Effizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-file\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. It cleans up resources, including networks and volumes, ensuring a tidy development environment.<\/p>","protected":false},"author":1,"featured_media":1683,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1183","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 Down - 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\/de\/wiki\/docker-compose-down\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Compose Down - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"`docker-compose down` is a command used to stop and remove containers defined in a Docker Compose file. It cleans up resources, including networks and volumes, ensuring a tidy development environment.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-down\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-22T20:51:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.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=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data1\" content=\"7\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/\",\"name\":\"Docker Compose Down - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg\",\"datePublished\":\"2024-07-22T20:45:20+00:00\",\"dateModified\":\"2024-07-22T20:51:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg\",\"width\":800,\"height\":600,\"caption\":\"docker-compose-down-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#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 Down\"}]},{\"@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\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dockerpros.com\/#organization\",\"name\":\"Dockerpros\",\"url\":\"https:\/\/dockerpros.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@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 Compose Down - Dockerpros\n\nDocker Compose ist ein leistungsstarkes Tool, das die Verwaltung von Multi-Container-Anwendungen vereinfacht. Es erm\u00f6glicht Ihnen, alle Ihre Anwendungs-Dienste mit einer einzigen Konfigurationsdatei zu definieren und zu verwalten. Aber was passiert, wenn Sie diese Dienste stoppen und entfernen m\u00fcssen? Hier kommt der Befehl \"docker-compose down\" ins Spiel.\n\nDer Befehl \"docker-compose down\" ist ein wesentlicher Bestandteil des Docker Compose-Toolkits. Er wird verwendet, um alle von Docker Compose verwalteten Container, Netzwerke und Volumes zu stoppen und zu entfernen. Dies ist besonders n\u00fctzlich, wenn Sie Ihre Entwicklungsumgebung aufr\u00e4umen oder zu einer neuen Version Ihrer Anwendung wechseln m\u00f6chten.\n\nWenn Sie \"docker-compose down\" ausf\u00fchren, stoppt Docker Compose zuerst alle laufenden Container, die in Ihrer docker-compose.yml-Datei definiert sind. Anschlie\u00dfend entfernt es diese Container. Standardm\u00e4\u00dfig entfernt es auch die von Docker Compose erstellten Netzwerke. Wenn Sie jedoch Volumes mit dem Schl\u00fcssel \"volumes\" in Ihrer docker-compose.yml-Datei definiert haben, bleiben diese erhalten, es sei denn, Sie f\u00fcgen die Option \"--volumes\" zum Befehl hinzu.\n\nEs ist wichtig zu beachten, dass \"docker-compose down\" keine Images entfernt. Wenn Sie auch die Images entfernen m\u00f6chten, m\u00fcssen Sie den Befehl \"docker image prune\" verwenden. Ebenso werden keine von Ihren Diensten erstellten Datenbanken oder Datenverzeichnisse entfernt, es sei denn, Sie haben sie als Volumes definiert.\n\nZusammenfassend ist \"docker-compose down\" ein leistungsstarker Befehl, der Ihnen hilft, Ihre Docker-Umgebung effizient zu verwalten. Er gibt Ihnen die Kontrolle dar\u00fcber, wann und wie Ihre Container, Netzwerke und Volumes entfernt werden, was ihn zu einem unverzichtbaren Werkzeug f\u00fcr jeden Docker Compose-Benutzer macht.","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\/de\/wiki\/docker-compose-down\/","og_locale":"de_DE","og_type":"article","og_title":"Docker Compose Down - Dockerpros","og_description":"`docker-compose down` is a command used to stop and remove containers defined in a Docker Compose file. It cleans up resources, including networks and volumes, ensuring a tidy development environment.","og_url":"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-down\/","og_site_name":"Dockerpros","article_modified_time":"2024-07-22T20:51:16+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"7\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/","url":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/","name":"Docker Compose Down - Dockerpros\n\nDocker Compose ist ein leistungsstarkes Tool, das die Verwaltung von Multi-Container-Anwendungen vereinfacht. Es erm\u00f6glicht Ihnen, alle Ihre Anwendungs-Dienste mit einer einzigen Konfigurationsdatei zu definieren und zu verwalten. Aber was passiert, wenn Sie diese Dienste stoppen und entfernen m\u00fcssen? Hier kommt der Befehl \"docker-compose down\" ins Spiel.\n\nDer Befehl \"docker-compose down\" ist ein wesentlicher Bestandteil des Docker Compose-Toolkits. Er wird verwendet, um alle von Docker Compose verwalteten Container, Netzwerke und Volumes zu stoppen und zu entfernen. Dies ist besonders n\u00fctzlich, wenn Sie Ihre Entwicklungsumgebung aufr\u00e4umen oder zu einer neuen Version Ihrer Anwendung wechseln m\u00f6chten.\n\nWenn Sie \"docker-compose down\" ausf\u00fchren, stoppt Docker Compose zuerst alle laufenden Container, die in Ihrer docker-compose.yml-Datei definiert sind. Anschlie\u00dfend entfernt es diese Container. Standardm\u00e4\u00dfig entfernt es auch die von Docker Compose erstellten Netzwerke. Wenn Sie jedoch Volumes mit dem Schl\u00fcssel \"volumes\" in Ihrer docker-compose.yml-Datei definiert haben, bleiben diese erhalten, es sei denn, Sie f\u00fcgen die Option \"--volumes\" zum Befehl hinzu.\n\nEs ist wichtig zu beachten, dass \"docker-compose down\" keine Images entfernt. Wenn Sie auch die Images entfernen m\u00f6chten, m\u00fcssen Sie den Befehl \"docker image prune\" verwenden. Ebenso werden keine von Ihren Diensten erstellten Datenbanken oder Datenverzeichnisse entfernt, es sei denn, Sie haben sie als Volumes definiert.\n\nZusammenfassend ist \"docker-compose down\" ein leistungsstarker Befehl, der Ihnen hilft, Ihre Docker-Umgebung effizient zu verwalten. Er gibt Ihnen die Kontrolle dar\u00fcber, wann und wie Ihre Container, Netzwerke und Volumes entfernt werden, was ihn zu einem unverzichtbaren Werkzeug f\u00fcr jeden Docker Compose-Benutzer macht.","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg","datePublished":"2024-07-22T20:45:20+00:00","dateModified":"2024-07-22T20:51:16+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/docker-compose-down\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-down_1183.jpg","width":800,"height":600,"caption":"docker-compose-down-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-down\/#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 Down"}]},{"@type":"WebSite","@id":"https:\/\/dockerpros.com\/#website","url":"https:\/\/dockerpros.com\/","name":"Docker-Profis","description":"DockerPros \u2013 Ihr umfassender Docker-Ressourcen-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":"de"},{"@type":"Organization","@id":"https:\/\/dockerpros.com\/#organization","name":"Docker-Profis","url":"https:\/\/dockerpros.com\/","logo":{"@type":"ImageObject","inLanguage":"de","@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\/de\/wp-json\/wp\/v2\/glossary\/1183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/glossary"}],"about":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/types\/glossary"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/glossary\/1183\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/media\/1683"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/media?parent=1183"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/glossary-cat?post=1183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}