{"id":176,"date":"2024-07-21T11:53:58","date_gmt":"2024-07-21T11:53:58","guid":{"rendered":"https:\/\/dockerpros.com\/?p=176"},"modified":"2024-07-21T11:53:58","modified_gmt":"2024-07-21T11:53:58","slug":"how-do-i-configure-restart-policies-in-docker","status":"publish","type":"post","link":"https:\/\/dockerpros.com\/de\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/","title":{"rendered":"Wie konfiguriere ich Neustartrichtlinien in Docker?\n\nDie Neustartrichtlinien f\u00fcr Docker-Container k\u00f6nnen auf zwei Hauptarten festgelegt werden:\n\n**1. Mit dem `docker run`-Befehl (CLI):**\nVerwenden Sie die Option `--restart` gefolgt von der gew\u00fcnschten Richtlinie.\n\nBeispiele:\n```bash\ndocker run -d --restart no mein-image\ndocker run -d --restart on-failure:5 mein-image  # Max. 5 Versuche\ndocker run -d --restart always mein-image\ndocker run -d --restart unless-stopped mein-image\n```\n\n**2. In einer `docker-compose.yml`-Datei:**\nF\u00fcgen Sie den Schl\u00fcssel `restart` im Service-Bereich hinzu.\n\nBeispiel:\n```yaml\nservices:\n  mein-service:\n    image: mein-image\n    restart: unless-stopped\n```\n\n**Verf\u00fcgbare Richtlinien:**\n- `no`: Kein automatischer Neustart (Standard).\n- `on-failure[:max-retries]`: Neustart nur bei Fehler (mit optionaler Wiederholungsgrenze).\n- `always`: Immer neu starten, au\u00dfer wenn explizit gestoppt.\n- `unless-stopped`: Immer neu starten, au\u00dfer wenn manuell gestoppt (beh\u00e4lt den Zustand \u00fcber Daemon-Neustarts hinweg)."},"content":{"rendered":"<h1>Wie man Neustartrichtlinien in Docker konfiguriert<\/h1>\n<p>Docker has revolutionized the way developers build, ship, and <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> Anwendungen. Es erm\u00f6glicht, Anwendungen in leichtgewichtigen Containern zu kapseln, was eine konsistente Bereitstellung in verschiedenen Umgebungen gew\u00e4hrleistet. Ein kritischer Aspekt beim Ausf\u00fchren von Anwendungen in Containern ist jedoch sicherzustellen, dass sie widerstandsf\u00e4hig sind und sich von unerwarteten Ausf\u00e4llen erholen k\u00f6nnen. Hier kommen Neustartrichtlinien ins Spiel. In diesem Artikel werden wir uns eingehend mit ... befassen. <span class=\"glossaryai-tooltip glossary-term-764\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-restart-policies\/\" target=\"_blank\">Docker Neustartrichtlinien<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker restart policies define how containers should behave when they exit or fail. Options include \"no,\" \"always,\" \"unless-stopped,\" and \"on-failure,\" allowing for customizable fault tolerance and service reliability.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-restart-policies\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, wie sie funktionieren und bew\u00e4hrte Methoden f\u00fcr ihre Konfiguration, um robuste Anwendungen zu gew\u00e4hrleisten.<\/p>\n<h2>What are Restart Policies?<\/h2>\n<p>In Docker ist eine Neustartrichtlinie ein Regelwerk, das festlegt, wie ein... <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> should behave when it exits or fails. The primary goal of restart policies is to ensure that the application running inside 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> remains available and operational, even in the face of unexpected errors. Docker provides several built-in restart policies that allow you to control the lifecycle of your containers in response to various exit conditions.<\/p>\n<h2>Why Use Restart Policies?<\/h2>\n<p>Container sind von Natur aus kurzlebig und k\u00f6nnen h\u00e4ufig beendet und neu gestartet werden. In Produktionsumgebungen m\u00f6chten wir jedoch, dass unsere Anwendungen m\u00f6glichst widerstandsf\u00e4hig sind. Die Nutzung von Neustartrichtlinien bietet mehrere Vorteile:<\/p>\n<ol>\n<li><strong>High Availability<\/strong>: By automatically restarting containers, you can maintain high availability of your services, reducing downtime.<\/li>\n<li><strong>Reduced Manual Intervention<\/strong>: Restart policies help automate recovery processes, minimizing the need for manual intervention by system administrators.<\/li>\n<li><strong>Verbesserte Zuverl\u00e4ssigkeit<\/strong>: Sicherzustellen, dass Ihre Container bei einem Ausfall neu starten, kann dazu beitragen, vor\u00fcbergehende Probleme zu erkennen, die andernfalls zu <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> disruptions.<\/li>\n<\/ol>\n<h2>Docker Restart Policies Overview<\/h2>\n<p>Docker offers several restart policy options, which can be set when building 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> or updated afterward. The available restart policies are:<\/p>\n<ol>\n<li>\n<p><strong>Nein (Standard)<\/strong>: Dies ist die Standardeinstellung. Container werden beim Beenden nicht automatisch neu gestartet.<\/p>\n<\/li>\n<li>\n<p><strong>Always<\/strong>: With this policy, Docker will restart 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> indefinitely, irrespective of the exit status. It is particularly useful for long-running services that must always be available.<\/p>\n<\/li>\n<li>\n<p><strong>Unless-stopped<\/strong>: Similar to the <code>immer<\/code> policy, this option will restart 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> unless it was explicitly stopped by the user. If 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, it won\u2019t restart until the Docker <span class=\"glossaryai-tooltip glossary-term-667\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/daemon\/\" target=\"_blank\">daemon<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Ein Daemon ist ein Hintergrundprozess in der Informatik, der autonom l\u00e4uft und Aufgaben ohne Benutzereingriff ausf\u00fchrt. Er \u00fcbernimmt typischerweise Funktionen auf System- oder Anwendungsebene und steigert so die Effizienz.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/daemon\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> itself is restarted.<\/p>\n<\/li>\n<li>\n<p><strong>On-failure<\/strong>: This policy allows for restarting 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> only if it exits with a non-zero exit status. You can also specify a maximum retry count, after which it will cease to restart 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<\/li>\n<li>\n<p><strong>On-failure with a maximum retry count<\/strong>: Dies ist eine Variante des <code>bei Fehlschlag<\/code> policy where you can specify how many times Docker should attempt to restart 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> before giving up.<\/p>\n<\/li>\n<\/ol>\n<h2>Konfiguration von Neustartrichtlinien<\/h2>\n<p>Restart policies can be configured during 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> creation process using the <code>docker <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><\/code> Befehl oder durch Anpassung des <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>. Lass uns beide Methoden erkunden.<\/p>\n<h3>Verwendung der Docker CLI<\/h3>\n<p>You can specify a restart policy when you <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> 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> mit der <code>--restart<\/code> flag. Here\u2019s how to do it for each policy:<\/p>\n<ul>\n<li>\n<p><strong>No<\/strong> (Standard):<\/p>\n<pre><code class=\"language-bash\">docker <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> --name my-container my-image<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Always<\/strong>:<\/p>\n<pre><code class=\"language-bash\">docker <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> --restart always --name my-container my-image<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Unless-stopped<\/strong>:<\/p>\n<pre><code class=\"language-bash\">docker <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> --restart unless-stopped --name my-container my-image<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>On-failure<\/strong>:<\/p>\n<pre><code class=\"language-bash\">docker <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> --restart on-failure --name my-container my-image<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>On-failure with a maximum retry count<\/strong> z.B. 5 Wiederholungen:<\/p>\n<pre><code class=\"language-bash\">docker <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> --restart on-failure:5 --name my-container my-image<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>Using Docker Compose<\/h3>\n<p>If you\u2019re using <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> Um Ihre Multi-Container-Anwendungen zu verwalten, k\u00f6nnen Sie die Neustartrichtlinie in der <code>docker-compose.yml<\/code> file. Here\u2019s an example:<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\ndienste:\n  mein-dienst:\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>mein-Image\n    neustart: immer<\/code><\/pre>\n<p>In diesem Beispiel <code>my-service<\/code> <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> will restart automatically whenever it exits.<\/p>\n<h2>Understanding Exit Codes<\/h2>\n<p>Um die <code>bei Fehlschlag<\/code> policy, it\u2019s crucial to understand the exit codes returned by applications. An exit code of <code>0<\/code> usually indicates success, while any non-zero code indicates an error or failure. By configuring the restart policy as <code>bei Fehlschlag<\/code>, Docker will restart 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> only when the application exits with a non-zero exit code.<\/p>\n<h3>Benutzerdefinierte Exit-Codes\n\nExit-Codes sind Zahlen, die von einem Programm zur\u00fcckgegeben werden, wenn es beendet wird. Sie werden verwendet, um den Erfolg oder Misserfolg der Ausf\u00fchrung eines Programms zu signalisieren. In der Regel gibt ein Exit-Code von 0 an, dass das Programm erfolgreich ausgef\u00fchrt wurde, w\u00e4hrend ein Exit-Code ungleich 0 auf einen Fehler hinweist.\n\nBenutzerdefinierte Exit-Codes erm\u00f6glichen es Entwicklern, spezifische Informationen \u00fcber den Grund f\u00fcr das Beenden eines Programms zu \u00fcbermitteln. Anstatt nur einen allgemeinen Fehler zu signalisieren, k\u00f6nnen benutzerdefinierte Exit-Codes verwendet werden, um verschiedene Arten von Fehlern oder spezifische Bedingungen zu unterscheiden.\n\nZum Beispiel k\u00f6nnte ein Programm, das Dateien verarbeitet, verschiedene Exit-Codes verwenden, um verschiedene Fehler zu signalisieren:\n\n- Exit-Code 1: Datei nicht gefunden\n- Exit-Code 2: Berechtigung verweigert\n- Exit-Code 3: Ung\u00fcltiges Dateiformat\n\nDurch die Verwendung benutzerdefinierter Exit-Codes k\u00f6nnen Entwickler und Benutzer besser verstehen, warum ein Programm beendet wurde und welche Schritte zur Fehlerbehebung erforderlich sind.\n\nIn Skripten und Batch-Dateien k\u00f6nnen benutzerdefinierte Exit-Codes verwendet werden, um den Ablauf des Skripts zu steuern. Zum Beispiel k\u00f6nnte ein Skript verschiedene Aktionen basierend auf dem Exit-Code eines aufgerufenen Programms ausf\u00fchren:\n\n```bash\n.\/programm\nif [ $? -eq 1 ]; then\n    echo \"Datei nicht gefunden\"\nelif [ $? -eq 2 ]; then\n    echo \"Berechtigung verweigert\"\nelse\n    echo \"Unbekannter Fehler\"\nfi\n```\n\nIn diesem Beispiel wird der Exit-Code des Programms `programm` \u00fcberpr\u00fcft und entsprechend unterschiedliche Aktionen ausgef\u00fchrt.\n\nBenutzerdefinierte Exit-Codes sind ein n\u00fctzliches Werkzeug f\u00fcr die Fehlerbehandlung und die Kommunikation zwischen Programmen und Skripten. Sie erm\u00f6glichen eine pr\u00e4zisere Steuerung des Programmablaufs und erleichtern die Fehlersuche und -behebung.<\/h3>\n<p>F\u00fcr Anwendungen, die benutzerdefinierte Exit-Codes zur\u00fcckgeben k\u00f6nnen, k\u00f6nnen Sie in Ihrer Anwendung Logik implementieren, um einen Fehler oder Erfolg zu signalisieren. Beispielsweise k\u00f6nnte ein Webserver einen von Null verschiedenen Exit-Code zur\u00fcckgeben, wenn er auf einen nicht behebbaren Fehler st\u00f6\u00dft, was Docker dazu veranlasst, ihn neu zu starten.<\/p>\n<h2>\u00dcberwachung des Neustartverhaltens<\/h2>\n<p>When using restart policies, it\u2019s essential to monitor the behavior of your containers. You can use the <code>docker ps<\/code> command to see the status of all running containers, which will indicate if 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> has been restarted.<\/p>\n<pre><code class=\"language-bash\">docker ps -a<\/code><\/pre>\n<p>This command will show you the state of each <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>, including how many times it has restarted. If you notice that 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> is restarting frequently, it may indicate an underlying issue with your application that needs to be addressed.<\/p>\n<h2>Limitations and Considerations<\/h2>\n<p>While restart policies are powerful tools for managing <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, there are some limitations and considerations to keep in mind:<\/p>\n<ol>\n<li>\n<p><strong>Unendliche Schleifen<\/strong>: Wenn ein <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> continuously fails and restarts, it may lead to an infinite restart loop, consuming system resources. It\u2019s essential to investigate the root cause of the failure.<\/p>\n<\/li>\n<li>\n<p><strong>Zustandsbehaftetheit<\/strong>: Restarting containers can lead to data loss if the application is not designed to handle state properly. Consider using persistent storage solutions, such as Docker volumes, to maintain data across <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.<\/p>\n<\/li>\n<li>\n<p><strong>\u00dcberwachung und Warnungen<\/strong>Implementieren Sie \u00dcberwachungsl\u00f6sungen, um die Gesundheit Ihrer Container im Auge zu behalten, was Ihnen helfen kann, Probleme proaktiv anzugehen, bevor sie zu Ausf\u00e4llen f\u00fchren.<\/p>\n<\/li>\n<li>\n<p><strong><span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/service\/\" target=\"_blank\">Dienstleistung<\/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> Abh\u00e4ngigkeiten<\/strong>: Wenn Sie mehrere miteinander verbundene Dienste haben, stellen Sie sicher, dass sie Neustarts elegant bew\u00e4ltigen k\u00f6nnen. Verwenden Sie <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> Werkzeuge wie <span class=\"glossaryai-tooltip glossary-term-656\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/kubernetes\/\" target=\"_blank\">Kubernetes<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Kubernetes ist eine Open-Source-Plattform zur Container-Orchestrierung, die die Bereitstellung, Skalierung und Verwaltung von containerisierten Anwendungen automatisiert und so die Ressourceneffizienz und Resilienz verbessert.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/kubernetes\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> for complex architectures that require advanced management.<\/p>\n<\/li>\n<\/ol>\n<h2>Beste Praktiken f\u00fcr die Konfiguration von Neustartrichtlinien<\/h2>\n<ol>\n<li>\n<p><strong>Bewerten Sie die Merkmale der Anwendung<\/strong>Verstehen Sie das erwartete Verhalten Ihrer Anwendung unter Fehlerbedingungen. Verwenden Sie die entsprechende Neustartrichtlinie basierend darauf, wie kritisch die Anwendung ist.<\/p>\n<\/li>\n<li>\n<p><strong>Implement Logging<\/strong>: Use logging mechanisms to capture errors and exit codes. This can help you diagnose issues that lead to <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> exits.<\/p>\n<\/li>\n<li>\n<p><strong>Testrichtlinien in der Entwicklung<\/strong>: Before deploying to production, test your restart policies in a staging environment. Simulate failure scenarios to ensure that your policies work as expected.<\/p>\n<\/li>\n<li>\n<p><strong>Verwenden Sie Gesundheitspr\u00fcfungen<\/strong>: Combine restart policies with health checks. Docker supports health checks that can help determine the state of 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>. If a <span class=\"glossaryai-tooltip glossary-term-698\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/health-check\/\" target=\"_blank\">health check<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A health check is a systematic evaluation of an individual's physical and mental well-being, often involving assessments of vital signs, medical history, and lifestyle factors to identify potential health risks.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/health-check\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> fails, you may want to stop or restart 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<\/li>\n<li>\n<p><strong>Monitor System Resources<\/strong>: Behalten Sie die Systemressourcen im Auge, um eine \u00dcberlastung Ihrer Host-Maschine durch zu viele Neustarts zu vermeiden. Konfigurieren Sie Grenzwerte, um eine Ressourcenersch\u00f6pfung zu verhindern.<\/p>\n<\/li>\n<\/ol>\n<h2>Fazit<\/h2>\n<p><span class=\"glossaryai-tooltip glossary-term-764\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-restart-policies\/\" target=\"_blank\">Docker Neustartrichtlinien<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker restart policies define how containers should behave when they exit or fail. Options include \"no,\" \"always,\" \"unless-stopped,\" and \"on-failure,\" allowing for customizable fault tolerance and service reliability.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/de\/wiki\/docker-restart-policies\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> are powerful tools for managing the lifecycle of containers, ensuring that your applications remain available and resilient. By understanding how restart policies work and configuring them effectively, you can significantly enhance the reliability of your Dockerized applications. However, it\u2019s essential to monitor the behavior of your containers and address underlying issues that may lead to frequent restarts. With proper implementation and monitoring, your applications can thrive in a containerized environment, providing consistent and reliable services to users.<\/p>","protected":false},"excerpt":{"rendered":"<p>Um Neustartrichtlinien in Docker zu konfigurieren, verwenden Sie das Flag `\u2013restart` mit Optionen wie `no`, `always`, `unless-stopped` oder `on-failure` w\u00e4hrend <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> Erstellung. Dadurch wird sichergestellt, dass Container basierend auf den angegebenen Bedingungen neu gestartet werden.<\/p>","protected":false},"author":1,"featured_media":384,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-176","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-installation-and-configuration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How do I configure restart policies in Docker? - 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\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How do I configure restart policies in Docker? - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"To configure restart policies in Docker, use the `--restart` flag with options like `no`, `always`, `unless-stopped`, or `on-failure` during container creation. This ensures containers restart based on specified conditions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/de\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-21T11:53:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.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=\"author\" content=\"dockerpros\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"dockerpros\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"6\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\"},\"author\":{\"name\":\"dockerpros\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4\"},\"headline\":\"How do I configure restart policies in Docker?\",\"datePublished\":\"2024-07-21T11:53:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\"},\"wordCount\":1078,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dockerpros.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg\",\"articleSection\":[\"Installation and Configuration\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\",\"url\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\",\"name\":\"How do I configure restart policies in Docker? - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg\",\"datePublished\":\"2024-07-21T11:53:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg\",\"width\":800,\"height\":600,\"caption\":\"how-do-i-configure-restart-policies-in-docker-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dockerpros.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How do I configure restart policies in Docker?\"}]},{\"@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\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4\",\"name\":\"dockerpros\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442\",\"caption\":\"dockerpros\"},\"sameAs\":[\"https:\/\/dockerpros.com\/\"],\"url\":\"https:\/\/dockerpros.com\/de\/author\/dockerpros\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wie konfiguriere ich Neustartrichtlinien in Docker? - Dockerpros","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dockerpros.com\/de\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/","og_locale":"de_DE","og_type":"article","og_title":"How do I configure restart policies in Docker? - Dockerpros","og_description":"To configure restart policies in Docker, use the `--restart` flag with options like `no`, `always`, `unless-stopped`, or `on-failure` during container creation. This ensures containers restart based on specified conditions.","og_url":"https:\/\/dockerpros.com\/de\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/","og_site_name":"Dockerpros","article_published_time":"2024-07-21T11:53:58+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg","type":"image\/jpeg"}],"author":"dockerpros","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"dockerpros","Gesch\u00e4tzte Lesezeit":"6\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#article","isPartOf":{"@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/"},"author":{"name":"dockerpros","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4"},"headline":"How do I configure restart policies in Docker?","datePublished":"2024-07-21T11:53:58+00:00","mainEntityOfPage":{"@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/"},"wordCount":1078,"commentCount":0,"publisher":{"@id":"https:\/\/dockerpros.com\/#organization"},"image":{"@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg","articleSection":["Installation and Configuration"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/","url":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/","name":"Wie konfiguriere ich Neustartrichtlinien in Docker? - Dockerpros","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg","datePublished":"2024-07-21T11:53:58+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-configure-restart-policies-in-docker_176.jpg","width":800,"height":600,"caption":"how-do-i-configure-restart-policies-in-docker-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/installation-and-configuration\/how-do-i-configure-restart-policies-in-docker\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dockerpros.com\/"},{"@type":"ListItem","position":2,"name":"How do I configure restart policies in Docker?"}]},{"@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\/"}},{"@type":"Person","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4","name":"dockerpros","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/image\/","url":"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442","contentUrl":"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1779972442","caption":"dockerpros"},"sameAs":["https:\/\/dockerpros.com\/"],"url":"https:\/\/dockerpros.com\/de\/author\/dockerpros\/"}]}},"_links":{"self":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/media\/384"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dockerpros.com\/de\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}