{"id":1203,"date":"2024-07-22T20:45:42","date_gmt":"2024-07-22T20:45:42","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1203"},"modified":"2024-07-22T20:51:31","modified_gmt":"2024-07-22T20:51:31","slug":"docker-compose-volumes","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-volumes\/","title":{"rendered":"Docker Compose Volumes"},"content":{"rendered":"<h1>Advanced Guide to Docker Compose Volumes<\/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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> ist ein m\u00e4chtiges Werkzeug, das es Entwicklern erm\u00f6glicht, mehrcontainerige Docker-Anwendungen zu definieren und zu verwalten. Im Kern davon <span class=\"glossaryai-tooltip glossary-term-657\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/orchestration\/\" target=\"_blank\">Orchestrierung<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Orchestrierung bezieht sich auf die automatisierte Verwaltung und Koordination komplexer Systeme und Dienstleistungen. Sie optimiert Prozesse durch die Integration verschiedener Komponenten und gew\u00e4hrleistet so einen effizienten Betrieb und eine optimale Ressourcennutzung.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/orchestration\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> lies the concept of Volumes, which serve as persistent storage solutions for containerized applications. In this article, we will explore the intricacies 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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Volumes, including their types, use cases, best practices, and troubleshooting techniques.<\/p>\n<h2>Was sind Docker Compose Volumes?<\/h2>\n<p>In essence, <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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Volumes are special directories within the host filesystem or managed by Docker that allow data to persist and be shared between containers across different runs. Unlike <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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> filesystems, which are ephemeral and destroyed when a <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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> stops or is removed, volumes provide a reliable way to store data, ensuring that it remains accessible and intact even when the containers themselves are discarded. This capability is crucial for modern application architectures, where state management is essential.<\/p>\n<h2>Types of Docker Volumes<\/h2>\n<p>Docker supports several types of volumes, each serving different use cases:<\/p>\n<h3>1. Named Volumes<\/h3>\n<p>Benannte Volumes werden von Docker verwaltet und k\u00f6nnen zwischen mehreren Containern geteilt werden. Sie werden in der <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> under the <code>volumes<\/code> section. Named volumes are ideal for scenarios where you need to maintain persistent data that can outlast <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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> lifecycles.<\/p>\n<p><strong>Beispiel:<\/strong><\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  app:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: my_app_image\n    volumes:\n      - my_data:\/data\n\nvolumes:\n  my_data:<\/code><\/pre>\n<p>In diesem Beispiel wird ein benannter <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> <code>my_data<\/code> is created and mounted to the <code>\/data<\/code> Verzeichnis im <code>App<\/code> <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 bezeichnet die Handlung, Unterst\u00fctzung oder Hilfe zu leisten, um spezifische Bed\u00fcrfnisse oder Anforderungen zu erf\u00fcllen. In verschiedenen Bereichen umfasst er Kundenservice, technischen Support und professionelle Dienstleistungen, wobei Effizienz und Nutzerzufriedenheit im Vordergrund stehen.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/p>\n<h3>2. Anonyme B\u00e4nde<\/h3>\n<p>Anonymous volumes are similar to named volumes, but they do not have a specific name. Docker automatically generates a unique name for them. They are useful for temporary data storage or for situations where the data does not need to persist beyond the lifecycle of the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>.<\/p>\n<p><strong>Beispiel:<\/strong><\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  app:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: my_app_image\n    volumes:\n      - \/data<\/code><\/pre>\n<p>Here, Docker will create an anonymous <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> f\u00fcr die <code>\/data<\/code> directory.<\/p>\n<h3>3. Host Volumes<\/h3>\n<p>Host volumes (or bind mounts) map a directory from the host filesystem into the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>. This allows for real-time synchronization of files between the host and the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>, which is particularly useful during development.<\/p>\n<p><strong>Beispiel:<\/strong><\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  app:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: my_app_image\n    volumes:\n      - .\/src:\/app\/src<\/code><\/pre>\n<p>In this case, the <code>.\/src<\/code> Verzeichnis auf dem Host wird in das <code>\/app\/src<\/code> directory within the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>.<\/p>\n<h2>Use Cases for Docker Compose Volumes<\/h2>\n<p>The versatility 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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Volumes makes them suitable for a variety of applications. Here are some common use cases:<\/p>\n<h3>1. Datenbankspeicherung<\/h3>\n<p>Databases require persistent storage to maintain data between <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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. Using named volumes ensures that your database data is not lost when the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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> is stopped or removed.<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  db:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: postgres:latest\n    volumes:\n      - db_data:\/var\/lib\/postgresql\/data\n\nvolumes:\n  db_data:<\/code><\/pre>\n<h3>2. Configuration Files<\/h3>\n<p>When developing applications, you often need to share configuration files between the host and the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>. Host volumes allow developers to tweak configurations without needing to rebuild the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>.<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  app:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: my_app_image\n    volumes:\n      - .\/config:\/app\/config<\/code><\/pre>\n<h3>3. Logs and Temporary Files<\/h3>\n<p>Storing logs outside of containers can be beneficial for monitoring and debugging. Named or host volumes can be used to direct log files to a persistent location.<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  app:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: my_app_image\n    volumes:\n      - logs:\/app\/logs\n\nvolumes:\n  logs:<\/code><\/pre>\n<h3>4. Daten zwischen Containern teilen<\/h3>\n<p>Volumes provide an easy way to share data between different services in a <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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> application. This can be particularly useful in microservice architectures where different services need to access shared resources.<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  service1:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: service1_image\n    volumes:\n      - shared_data:\/data\n\n  service2:\n    <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\" target=\"_blank\">Bild<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Bild ist eine visuelle Darstellung eines Objekts oder einer Szene, die typischerweise aus Pixeln in digitalen Formaten besteht. Es kann Informationen vermitteln, Emotionen hervorrufen und die Kommunikation \u00fcber verschiedene Medien hinweg erleichtern.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: service2_image\n    volumes:\n      - shared_data:\/data\n\nvolumes:\n  shared_data:<\/code><\/pre>\n<h2>Best Practices for Using Docker Compose Volumes<\/h2>\n<p>To maximize the effectiveness 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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Volumes, consider the following best practices:<\/p>\n<h3>Verwenden Sie benannte Volumes f\u00fcr persistente Daten.<\/h3>\n<p>Whenever you need data to persist beyond the life of a single <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>, use named volumes. This helps avoid data loss and simplifies backup and restore operations.<\/p>\n<h3>2. Organize Your Volume Definitions<\/h3>\n<p>Halten Sie Abstand. <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> definitions clear and organized. Group volumes at the bottom of your <code>docker-compose.yml<\/code> file to improve readability. For larger applications, consider using multiple Compose files to separate concerns.<\/p>\n<h3>3. Backup and Restore Volumes<\/h3>\n<p>Since volumes can contain critical data, ensure you have a backup strategy in place. Use tools like <code>docker cp<\/code> or third-party <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> management solutions to back up data.<\/p>\n<h3>4. \u00dcberwachen Sie die Nutzung<\/h3>\n<p>Keep track of your volumes and their storage usage. Regularly audit your volumes to clean up unused or stale volumes, which can consume disk space unnecessarily.<\/p>\n<h3>5. Vermeiden Sie Host-Volumes in der Produktion\n\nHost-Volumes sind zwar praktisch f\u00fcr die Entwicklung, aber in der Produktion sollten Sie sie vermeiden. Host-Volumes k\u00f6nnen zu Sicherheitsproblemen f\u00fchren, da sie den Zugriff auf das Host-Dateisystem erm\u00f6glichen. In der Produktion sollten Sie stattdessen Docker-Volumes verwenden, die eine bessere Isolation und Sicherheit bieten.<\/h3>\n<p>While host volumes can be very useful in development, avoid using them in production environments. They can lead to issues related to portability and consistency, as they depend on the host filesystem.<\/p>\n<h2>Troubleshooting Docker Compose Volumes<\/h2>\n<p>Probleme mit Volumes k\u00f6nnen aus verschiedenen Gr\u00fcnden auftreten. Hier sind einige h\u00e4ufige Probleme und deren L\u00f6sungen:<\/p>\n<h3>1. Data Not Persisting<\/h3>\n<p>If data is disappearing after <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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, ensure that you are using named volumes correctly. Check your <code>docker-compose.yml<\/code> file to confirm that the <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> is defined and mounted properly.<\/p>\n<h3>2. Permission Issues<\/h3>\n<p>When using host volumes, permission issues can prevent containers from accessing the mounted directory. Ensure that the user running the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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> has the necessary permissions to access the host directory.<\/p>\n<h3>3. Konflikte mit vorhandenen Daten<\/h3>\n<p>If using host volumes, be mindful of existing data in the directory being mounted. Docker will overwrite this data with the data in the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/container\/\" target=\"_blank\">Beh\u00e4lter<\/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>, which might not be the desired behavior.<\/p>\n<h3>4. Volume nicht gefunden<\/h3>\n<p>If you encounter an error indicating that a <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> cannot be found, check if the <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> was defined in the <code>volumes<\/code> section of your <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>. You can also use <code><span class=\"glossaryai-tooltip glossary-term-1171\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/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\">Der Befehl `docker volume ls` listet alle Docker-Volumes auf dem Host auf. Dieser Befehl hilft Benutzern, persistente Datenspeicherung effizient zu verwalten, und liefert wichtige Details wie den Volumennamen und den Treiber.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-volume-ls\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/code> verf\u00fcgbare Volumes anzeigen.<\/p>\n<h3>5. Cleanup of Unused Volumes<\/h3>\n<p>Um nicht verwendete Volumes zu entfernen, k\u00f6nnen Sie <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/run\/\" target=\"_blank\">laufen<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" bezeichnet einen Befehl in verschiedenen Programmiersprachen und Betriebssystemen, um ein angegebenes Programm oder Skript auszuf\u00fchren. Er initiiert Prozesse und stellt eine kontrollierte Ausf\u00fchrungsumgebung f\u00fcr die Aufgabenbereitstellung bereit.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> der Befehl<\/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 ist ein Befehl, der verwendet wird, um alle ungenutzten Volumes von Ihrem System zu entfernen. Dies hilft dabei, den Speicherplatz effizient zu verwalten, indem verwaiste Daten entfernt werden, die nicht mehr mit einem Container verkn\u00fcpft sind.<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, helping to free up disk space.<\/p>\n<h2>Fazit<\/h2>\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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Volumes are a critical tool for managing data in containerized applications. By understanding the different types of volumes, their use cases, and best practices, developers can ensure that their applications are robust, efficient, and maintainable. Whether you are building a simple web application or a complex microservices architecture, effective <span class=\"glossaryai-tooltip glossary-term-660\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/volume\/\" target=\"_blank\">Band<\/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> management can significantly enhance the reliability and functionality of your Docker deployments. By adopting the strategies and solutions outlined in this article, you will be well-equipped to leverage <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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Volumes to their fullest potential.<\/p>","protected":false},"excerpt":{"rendered":"<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 ist ein Werkzeug zur Definition und Ausf\u00fchrung von Multi-Container-Docker-Anwendungen mithilfe einer YAML-Datei. Es vereinfacht die Bereitstellung, Konfiguration und Orchestrierung von Diensten und verbessert die Entwicklungseffizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> volumes are essential for persistent data storage in multi-container applications. They allow containers to share data and maintain state, ensuring data consistency across restarts.<\/p>","protected":false},"author":1,"featured_media":1723,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1203","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 Volumes - 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-volumes\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Compose Volumes - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"Docker Compose volumes are essential for persistent data storage in multi-container applications. They allow containers to share data and maintain state, ensuring data consistency across restarts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-volumes\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-22T20:51:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.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=\"5\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-volumes\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/\",\"name\":\"Docker Compose Volumes - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg\",\"datePublished\":\"2024-07-22T20:45:42+00:00\",\"dateModified\":\"2024-07-22T20:51:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg\",\"width\":800,\"height\":600,\"caption\":\"docker-compose-volumes-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#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 Volumes\"}]},{\"@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 Volumes - Dockerpros\n\nVolumes sind das bevorzugte Mittel zur Persistenz von Daten in Docker-Containern. Einige der Vorteile von Volumes sind:\n\n- Volumes sind einfacher zu sichern oder zu migrieren als Bind-Mounts.\n- Sie k\u00f6nnen Volume-Treiber verwenden, um Ihre Daten auf Remote-Hosts oder Cloud-Anbieter zu speichern, Ihre Daten zu verschl\u00fcsseln oder zus\u00e4tzliche Funktionen hinzuzuf\u00fcgen.\n- Neue Volumes k\u00f6nnen ihren Inhalt von einem Container haben.\n- Volumes sind oft die beste Wahl f\u00fcr die Zusammenarbeit zwischen mehreren Containern.\n\nIn diesem Artikel werden wir uns mit der Verwendung von Volumes in Docker Compose besch\u00e4ftigen.\n\nVolumes in Docker Compose\n\nIn Docker Compose k\u00f6nnen Sie Volumes auf zwei Arten verwenden:\n\n1. Definieren Sie ein Volume in Ihrer Docker Compose-Datei und verwenden Sie es dann in Ihren Diensten.\n2. Verwenden Sie ein vorhandenes Volume, das au\u00dferhalb von Docker Compose erstellt wurde.\n\nLassen Sie uns beide Methoden im Detail betrachten.\n\n1. Definieren eines Volumes in Docker Compose\n\nUm ein Volume in Docker Compose zu definieren, f\u00fcgen Sie einen volumes-Abschnitt zu Ihrer Docker Compose-Datei hinzu. Hier ist ein Beispiel:\n\n```yaml\nversion: '3.8'\n\nservices:\n  web:\n    image: nginx:latest\n    volumes:\n      - mydata:\/data\n\nvolumes:\n  mydata:\n```\n\nIn diesem Beispiel definieren wir ein Volume namens \"mydata\" und verwenden es dann im \"web\"-Dienst. Das Volume wird am Pfad \"\/data\" im Container eingeh\u00e4ngt.\n\n2. Verwenden eines vorhandenen Volumes\n\nWenn Sie ein Volume verwenden m\u00f6chten, das au\u00dferhalb von Docker Compose erstellt wurde, k\u00f6nnen Sie den Namen des Volumes direkt in Ihrer Docker Compose-Datei angeben. Hier ist ein Beispiel:\n\n```yaml\nversion: '3.8'\n\nservices:\n  web:\n    image: nginx:latest\n    volumes:\n      - my-existing-volume:\/data\n```\n\nIn diesem Beispiel verwenden wir ein vorhandenes Volume namens \"my-existing-volume\" und h\u00e4ngen es am Pfad \"\/data\" im Container ein.\n\nDas war's! Sie wissen jetzt, wie Sie Volumes in Docker Compose verwenden k\u00f6nnen.","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-volumes\/","og_locale":"de_DE","og_type":"article","og_title":"Docker Compose Volumes - Dockerpros","og_description":"Docker Compose volumes are essential for persistent data storage in multi-container applications. They allow containers to share data and maintain state, ensuring data consistency across restarts.","og_url":"https:\/\/dockerpros.com\/de\/wiki\/docker-compose-volumes\/","og_site_name":"Dockerpros","article_modified_time":"2024-07-22T20:51:31+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"5\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/","url":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/","name":"Docker Compose Volumes - Dockerpros\n\nVolumes sind das bevorzugte Mittel zur Persistenz von Daten in Docker-Containern. Einige der Vorteile von Volumes sind:\n\n- Volumes sind einfacher zu sichern oder zu migrieren als Bind-Mounts.\n- Sie k\u00f6nnen Volume-Treiber verwenden, um Ihre Daten auf Remote-Hosts oder Cloud-Anbieter zu speichern, Ihre Daten zu verschl\u00fcsseln oder zus\u00e4tzliche Funktionen hinzuzuf\u00fcgen.\n- Neue Volumes k\u00f6nnen ihren Inhalt von einem Container haben.\n- Volumes sind oft die beste Wahl f\u00fcr die Zusammenarbeit zwischen mehreren Containern.\n\nIn diesem Artikel werden wir uns mit der Verwendung von Volumes in Docker Compose besch\u00e4ftigen.\n\nVolumes in Docker Compose\n\nIn Docker Compose k\u00f6nnen Sie Volumes auf zwei Arten verwenden:\n\n1. Definieren Sie ein Volume in Ihrer Docker Compose-Datei und verwenden Sie es dann in Ihren Diensten.\n2. Verwenden Sie ein vorhandenes Volume, das au\u00dferhalb von Docker Compose erstellt wurde.\n\nLassen Sie uns beide Methoden im Detail betrachten.\n\n1. Definieren eines Volumes in Docker Compose\n\nUm ein Volume in Docker Compose zu definieren, f\u00fcgen Sie einen volumes-Abschnitt zu Ihrer Docker Compose-Datei hinzu. Hier ist ein Beispiel:\n\n```yaml\nversion: '3.8'\n\nservices:\n  web:\n    image: nginx:latest\n    volumes:\n      - mydata:\/data\n\nvolumes:\n  mydata:\n```\n\nIn diesem Beispiel definieren wir ein Volume namens \"mydata\" und verwenden es dann im \"web\"-Dienst. Das Volume wird am Pfad \"\/data\" im Container eingeh\u00e4ngt.\n\n2. Verwenden eines vorhandenen Volumes\n\nWenn Sie ein Volume verwenden m\u00f6chten, das au\u00dferhalb von Docker Compose erstellt wurde, k\u00f6nnen Sie den Namen des Volumes direkt in Ihrer Docker Compose-Datei angeben. Hier ist ein Beispiel:\n\n```yaml\nversion: '3.8'\n\nservices:\n  web:\n    image: nginx:latest\n    volumes:\n      - my-existing-volume:\/data\n```\n\nIn diesem Beispiel verwenden wir ein vorhandenes Volume namens \"my-existing-volume\" und h\u00e4ngen es am Pfad \"\/data\" im Container ein.\n\nDas war's! Sie wissen jetzt, wie Sie Volumes in Docker Compose verwenden k\u00f6nnen.","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg","datePublished":"2024-07-22T20:45:42+00:00","dateModified":"2024-07-22T20:51:31+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-volumes_1203.jpg","width":800,"height":600,"caption":"docker-compose-volumes-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-volumes\/#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 Volumes"}]},{"@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\/1203","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\/1203\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/media\/1723"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/media?parent=1203"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/glossary-cat?post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}