{"id":7190,"date":"2026-09-30T14:59:28","date_gmt":"2026-09-30T19:59:28","guid":{"rendered":"https:\/\/ykim.synology.me\/wordpress\/docker-automatic-restart-7190\/"},"modified":"2026-09-30T14:59:38","modified_gmt":"2026-09-30T19:59:38","slug":"docker-automatic-restart","status":"publish","type":"post","link":"https:\/\/ykim.synology.me\/wordpress\/docker-automatic-restart-7190\/","title":{"rendered":"Docker Automatic Restart"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/github.com\/yBarn1\/Images\/blob\/main\/produce\/red-apples-produce-bin.jpg?raw=true\" alt=\"\" style=\"width:auto;height:500px\"\/><\/figure>\n\n\n<p><div class=\"github-readme-container markdown-body\"><div id=\"file\" class=\"md\" data-path=\"Docker\/docker-restart-ko.md\"><article class=\"markdown-body entry-content container-lg\" itemprop=\"text\"><div class=\"markdown-heading\" dir=\"auto\"><h1 class=\"heading-element\" dir=\"auto\">Docker Automatic Restart<\/h1><a id=\"user-content-docker-automatic-restart\" class=\"anchor\" aria-label=\"Permalink: Docker Automatic Restart\" href=\"#docker-automatic-restart\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">Rev. 11 | Created: 2026-07-20 | Updated: 2026-10-11 01:25 CDT<\/p>\n<p dir=\"auto\">docker compose \ub9cc\uc73c\ub85c \uc2a4\uc2a4\ub85c \ubcf5\uad6c\ub418\ub294 container \ub97c \uad6c\uc131\ud558\ub294 \ubc29\ubc95\uc744 \ub2e4\ub8f9\ub2c8\ub2e4. container \uac00 \uc8fd\uac70\ub098 \uace0\uc7a5\ub0ac\uc744 \ub54c \uc790\ub3d9\uc73c\ub85c \ub2e4\uc2dc \ub744\uc6b0\ub294 \ub450 \uacbd\ub85c\ub97c \uc815\ub9ac\ud569\ub2c8\ub2e4. <strong>restart policy<\/strong> \ub294 container \uac00 <strong>exit<\/strong> \ub420 \ub54c, <strong>healthcheck + autoheal<\/strong> \uc740 container \ub294 \uc0b4\uc544\uc788\ub294\ub370 \uc548\uc758 process \ub9cc \uc8fd\uac70\ub098 hang \ub420 \ub54c\ub97c \ub2f4\ub2f9\ud569\ub2c8\ub2e4. \ub458\uc740 \ubcf4\uc644 \uad00\uacc4\uc774\uba70, \ub450 \uacbd\ub85c \ubaa8\ub450 \ucd5c\uc885\uc801\uc73c\ub85c <code>docker restart<\/code> \uc5d0 \ub3c4\ub2ec\ud569\ub2c8\ub2e4. \uc608\uc2dc\ub85c Temporal server 1.25 \uc758 dev\/quickstart image (<code>temporalio\/auto-setup:1.25<\/code>) \ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"                   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n                   \u2502 docker daemon \u2502\n                   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                           \u2502\n            \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n            \u2502                              \u2502\n   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510          \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n   \u2502  restart policy  \u2502          \u2502 healthcheck.test \u2502\n   \u2502 (unless-stopped) \u2502          \u2502 (every interval) \u2502\n   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518          \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n            \u2502                             \u2502\n            \u2502 container exit              \u2502 retries consecutive\n            \u2502 (PID 1 dies \/ crash \/       \u2502 failures (exit != 0)\n            \u2502  host reboot)               \u25bc\n            \u2502                Health.Status = unhealthy\n            \u2502                   (set by the daemon)\n            \u2502                             \u2502\n            \u2502                 [willfarrell\/autoheal]\n            \u2502           polls every AUTOHEAL_INTERVAL (5s)\n            \u2502           matches autoheal label + unhealthy\n            \u2502                             \u2502\n            \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                           \u25bc\n                  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n                  \u2502 docker restart \u2502\n                  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\"><pre class=\"notranslate\"><code>                   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n                   \u2502 docker daemon \u2502\n                   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                           \u2502\n            \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n            \u2502                              \u2502\n   \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510          \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n   \u2502  restart policy  \u2502          \u2502 healthcheck.test \u2502\n   \u2502 (unless-stopped) \u2502          \u2502 (every interval) \u2502\n   \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518          \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n            \u2502                             \u2502\n            \u2502 container exit              \u2502 retries consecutive\n            \u2502 (PID 1 dies \/ crash \/       \u2502 failures (exit != 0)\n            \u2502  host reboot)               \u25bc\n            \u2502                Health.Status = unhealthy\n            \u2502                   (set by the daemon)\n            \u2502                             \u2502\n            \u2502                 &#91;willfarrell\/autoheal&#93;\n            \u2502           polls every AUTOHEAL_INTERVAL (5s)\n            \u2502           matches autoheal label + unhealthy\n            \u2502                             \u2502\n            \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n                           \u25bc\n                  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n                  \u2502 docker restart \u2502\n                  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n<\/code><\/pre><\/div>\n<p dir=\"auto\"><a id=\"user-content-fig-1\"><\/a>\nFig 1. Two restart paths<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">1. Restart Policy<\/h2><a id=\"user-content-1-restart-policy\" class=\"anchor\" aria-label=\"Permalink: 1. Restart Policy\" href=\"#1-restart-policy\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">container \uc758 <strong>exit<\/strong> \uc5d0 \ubc18\uc751\ud569\ub2c8\ub2e4. exit \uc740 \uace7 <strong>PID 1 \uc885\ub8cc<\/strong> \uc774\ubbc0\ub85c (\u2192 <a href=\"#container-lifecycle--pid-1\">Container Lifecycle &amp; PID 1<\/a>), server process \uac00 PID 1 \uc774\uba74 \uadf8 \uc8fd\uc74c\uc774 container exit \uc73c\ub85c \uc804\ud30c\ub418\uc5b4 \uc5ec\uae30\uc11c \ubcf5\uad6c\ub429\ub2c8\ub2e4.<\/p>\n<div class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"services:\n  temporal:\n    image: temporalio\/auto-setup:1.25\n    restart: unless-stopped        # auto-recovery from crash \/ reboot\"><pre><span class=\"pl-ent\">services<\/span>:\n  <span class=\"pl-ent\">temporal<\/span>:\n    <span class=\"pl-ent\">image<\/span>: <span class=\"pl-s\">temporalio\/auto-setup:1.25<\/span>\n    <span class=\"pl-ent\">restart<\/span>: <span class=\"pl-s\">unless-stopped        <\/span><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> auto-recovery from crash \/ reboot<\/span><\/pre><\/div>\n<p dir=\"auto\">Table 1. Restart policies<\/p>\n<markdown-accessiblity-table><table>\n<thead>\n<tr>\n<th align=\"center\">Policy<\/th>\n<th align=\"center\">Behavior<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"center\"><code>no<\/code><\/td>\n<td align=\"center\">\uc7ac\uc2dc\uc791\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4 (\uae30\ubcf8).<\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><code>on-failure&#91;:N&#93;<\/code><\/td>\n<td align=\"center\">exit code \u2260 0 \uc77c \ub54c\ub9cc, \ucd5c\ub300 N \ud68c \uc7ac\uc2dc\uc791\ud569\ub2c8\ub2e4.<\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><code>always<\/code><\/td>\n<td align=\"center\">\ud56d\uc0c1 \uc7ac\uc2dc\uc791\ud569\ub2c8\ub2e4 (\uc218\ub3d9 stop \ud6c4 daemon \uc7ac\uc2dc\uc791 \uc2dc\uc5d0\ub3c4 \ub2e4\uc2dc \ub738).<\/td>\n<\/tr>\n<tr>\n<td align=\"center\"><code>unless-stopped<\/code><\/td>\n<td align=\"center\">\ud56d\uc0c1 \uc7ac\uc2dc\uc791\ud558\ub418 <strong>\uba85\uc2dc\uc801 <code>docker stop<\/code> \uc740 \uc81c\uc678<\/strong> \ud569\ub2c8\ub2e4. reboot \uc0dd\uc874. <strong>\uad8c\uc7a5<\/strong>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/markdown-accessiblity-table>\n<p dir=\"auto\">\ud55c\uacc4: restart policy \ub294 <strong>exit \ub9cc<\/strong> \ubd05\ub2c8\ub2e4. container \uac00 running \uc778\ub370 \uc548\uc758 server \ub9cc \uc8fd\uac70\ub098 hang \uc778 \uacbd\uc6b0\ub294 \ubabb \uc7a1\uc2b5\ub2c8\ub2e4 \u2192 <a href=\"#2-healthcheck--autoheal\">2. Healthcheck &amp; Autoheal<\/a>.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">Container Lifecycle &amp; PID 1<\/h3><a id=\"user-content-container-lifecycle--pid-1\" class=\"anchor\" aria-label=\"Permalink: Container Lifecycle &amp; PID 1\" href=\"#container-lifecycle--pid-1\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">container \uc218\uba85\uc740 <strong>PID 1 \ud558\ub098\uc5d0 \ubb36\uc5ec \uc788\uc2b5\ub2c8\ub2e4<\/strong>: <strong>PID 1 \uc774 \uc885\ub8cc\ub418\uba74 container \ub3c4 \uc885\ub8cc<\/strong> \ub429\ub2c8\ub2e4 (\uc790\uc2dd process \uac00 \ub0a8\uc544\uc788\ub4e0 \ubb34\uad00). restart policy \ub294 \uc774 \uc774\ubca4\ud2b8\ub97c \uac10\uc2dc\ud569\ub2c8\ub2e4.<\/p>\n<p dir=\"auto\">PID 1 \uc774 \ub204\uac00 \ub418\ub294\uc9c0\ub294 image \uc758 <code>ENTRYPOINT<\/code>\/<code>CMD<\/code> \uac00 \uacb0\uc815\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"# last line of entrypoint.sh\nexec temporal-server start    # exec replaces the shell with the server \u2192 server becomes PID 1  \u2705\ntemporal-server start         # no exec \u2192 shell stays PID 1, server runs as a child (PID 7)  \u274c\"><pre><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> last line of entrypoint.sh<\/span>\n<span class=\"pl-c1\">exec<\/span> temporal-server start    <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> exec replaces the shell with the server \u2192 server becomes PID 1  \u2705<\/span>\ntemporal-server start         <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> no exec \u2192 shell stays PID 1, server runs as a child (PID 7)  \u274c<\/span><\/pre><\/div>\n<ul dir=\"auto\">\n<li><strong>server \uac00 PID 1 (\uacbd\uc6b0 A)<\/strong> \u2014 server crash \u2192 PID 1 \uc885\ub8cc \u2192 container exit \u2192 restart policy \uac00 \ubcf5\uad6c\ud569\ub2c8\ub2e4. \uacf5\uc2dd <code>temporalio\/*<\/code> image \uac00 \uc774 \ubc29\uc2dd\uc785\ub2c8\ub2e4 (<code>exec<\/code> \uc0ac\uc6a9).<\/li>\n<li><strong>wrapper \uac00 PID 1 (\uacbd\uc6b0 B)<\/strong> \u2014 server (\uc790\uc2dd) crash \u2192 PID 1 (shell) \uc0dd\uc874 \u2192 container \ub294 running \uc720\uc9c0 \u2192 restart policy \ub294 \ubabb \ubd05\ub2c8\ub2e4 \u2192 \"running container, dead server\" zombie \uac00 \ub429\ub2c8\ub2e4. custom image \ub77c\uba74 entrypoint \ub97c \ubc18\ub4dc\uc2dc <code>exec &lt;server&gt;<\/code> \ub85c \ub05d\ub0bc \uac83.<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">2. Healthcheck &amp; Autoheal<\/h2><a id=\"user-content-2-healthcheck--autoheal\" class=\"anchor\" aria-label=\"Permalink: 2. Healthcheck &amp; Autoheal\" href=\"#2-healthcheck--autoheal\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\">container \uac00 running \uc774\uc5b4\ub3c4 \uc548\uc758 server \uac00 \uc8fd\uac70\ub098 hang \uc778 \uacbd\uc6b0\ub97c \ub2f4\ub2f9\ud558\ub294 \uacbd\ub85c\uc785\ub2c8\ub2e4. healthcheck \uac00 \uac10\uc9c0\ud558\uace0, autoheal \uc774 <code>docker restart<\/code> \ub97c \uc2e4\ud589\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">Healthcheck &amp; Health.Status<\/h3><a id=\"user-content-healthcheck--healthstatus\" class=\"anchor\" aria-label=\"Permalink: Healthcheck &amp; Health.Status\" href=\"#healthcheck--healthstatus\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<div class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"    healthcheck:\n      test: [&quot;CMD&quot;,&quot;temporal&quot;,&quot;operator&quot;,&quot;cluster&quot;,&quot;health&quot;,&quot;--address&quot;,&quot;localhost:7233&quot;]\n      interval: 30s\n      timeout: 10s\n      retries: 3\"><pre>    <span class=\"pl-ent\">healthcheck<\/span>:\n      <span class=\"pl-ent\">test<\/span>: <span class=\"pl-s\">&#91;\"CMD\",\"temporal\",\"operator\",\"cluster\",\"health\",\"--address\",\"localhost:7233\"&#93;<\/span>\n      <span class=\"pl-ent\">interval<\/span>: <span class=\"pl-c1\">30s<\/span>\n      <span class=\"pl-ent\">timeout<\/span>: <span class=\"pl-c1\">10s<\/span>\n      <span class=\"pl-ent\">retries<\/span>: <span class=\"pl-c1\">3<\/span><\/pre><\/div>\n<ul dir=\"auto\">\n<li>\uc704 <code>test<\/code> \ub294 container \uc548\uc5d0\uc11c <code>temporal<\/code> CLI \ub97c \uc2e4\ud589\ud574 <code>localhost:7233<\/code> \uc758 frontend \ub85c gRPC health check \ub97c \ubcf4\ub0c5\ub2c8\ub2e4. \uc2e4\ud328 \uacbd\ub85c\ub294 \uc138 \uac00\uc9c0\uc785\ub2c8\ub2e4: server process \uac00 \uc8fd\uc5b4 port \uac00 \ub2eb\ud614\uc73c\uba74 connection refused \ub85c \uc989\uc2dc \uc2e4\ud328\ud558\uace0, server \uac00 hang \uc774\uba74 \uc751\ub2f5\uc774 \uc5c6\uc5b4 <code>timeout<\/code> (10s) \ucd08\uacfc\ub85c Docker \uac00 \uba85\ub839\uc744 \uac15\uc81c \uc885\ub8cc\ud558\uba70, process \uac00 \ub5a0 \uc788\uc5b4\ub3c4 frontend \uac00 SERVING \uc0c1\ud0dc\uac00 \uc544\ub2c8\uba74 CLI \uac00 \uc2a4\uc2a4\ub85c \uc2e4\ud328\ud569\ub2c8\ub2e4. \uc138 \uacbd\uc6b0 \ubaa8\ub450 exit code \u2260 0 \uc774 \ub418\uace0, \uc774\uac83\uc774 \uc5f0\uc18d <code>retries<\/code> (3) \ud68c \ubc18\ubcf5\ub418\uba74 daemon \uc774 <code>Health.Status<\/code> \ub97c <code>unhealthy<\/code> \ub85c \uc124\uc815\ud569\ub2c8\ub2e4.<\/li>\n<li><code>test<\/code> \uba85\ub839\uc740 <strong>\uc0ac\uc6a9\uc790\uac00 \uc791\uc131<\/strong> \ud569\ub2c8\ub2e4. Docker \ub294 \uc774\ub97c <code>interval<\/code> \ub9c8\ub2e4 \uc2e4\ud589\ud558\ub294 <strong>mechanism \ub9cc<\/strong> \uc81c\uacf5\ud569\ub2c8\ub2e4. \uba85\ub839\uc774 \ubb34\uc5c7\uc744 \uac80\uc0ac\ud560\uc9c0\ub294 \uc804\uc801\uc73c\ub85c \uc791\uc131\uc790\uac00 \uc815\ud558\uba70, Docker \ub294 PID 1 \uc744 \ub530\ub85c \ubaa8\ub2c8\ud130\ub9c1\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/li>\n<li>\ud310\uc815\uc740 <strong>exit code<\/strong> \ub85c\ub9cc \ud569\ub2c8\ub2e4: <code>0<\/code> = healthy, <code>1<\/code> = unhealthy, <code>2<\/code> = <strong>reserved (\uc0ac\uc6a9 \uae08\uc9c0)<\/strong>.<\/li>\n<li>Docker <strong>daemon<\/strong> \uc774 exit code \ub97c \uc77d\uc5b4, \uc5f0\uc18d <code>retries<\/code> \ud68c \uc2e4\ud328 \uc2dc container \uc758 <strong><code>Health.Status<\/code><\/strong> \ub97c <code>unhealthy<\/code> \ub85c \uc124\uc815\ud569\ub2c8\ub2e4 (<code>healthy<\/code> \/ <code>unhealthy<\/code> \/ <code>starting<\/code>). <code>docker ps<\/code> \uc758 STATUS \ub098 <code>docker inspect<\/code> \ub85c \ud655\uc778\ud569\ub2c8\ub2e4.<\/li>\n<li>\uc8fc\uc758: <strong>restart policy \ub294 <code>Health.Status<\/code> \ub97c \ubcf4\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/strong> unhealthy \uc5ec\ub3c4 daemon \uc774 \uc2a4\uc2a4\ub85c \uc7ac\uc2dc\uc791\ud558\uc9c0 \uc54a\uc73c\ubbc0\ub85c, \uc870\uce58\ud560 \uc8fc\uccb4\uac00 \ub530\ub85c \ud544\uc694\ud569\ub2c8\ub2e4 \u2192 <a href=\"#autoheal\">Autoheal<\/a>.<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h3 class=\"heading-element\" dir=\"auto\">Autoheal<\/h3><a id=\"user-content-autoheal\" class=\"anchor\" aria-label=\"Permalink: Autoheal\" href=\"#autoheal\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<p dir=\"auto\"><code>unhealthy<\/code> container \ub97c \uc2e4\uc81c\ub85c \uc7ac\uc2dc\uc791\ud558\ub294 \uc8fc\uccb4\uc785\ub2c8\ub2e4.<\/p>\n<div class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"  autoheal:\n    image: willfarrell\/autoheal\n    environment: [AUTOHEAL_CONTAINER_LABEL=autoheal]   # label key to watch\n    volumes: [&quot;\/var\/run\/docker.sock:\/var\/run\/docker.sock&quot;]\n    restart: unless-stopped\"><pre>  <span class=\"pl-ent\">autoheal<\/span>:\n    <span class=\"pl-ent\">image<\/span>: <span class=\"pl-s\">willfarrell\/autoheal<\/span>\n    <span class=\"pl-ent\">environment<\/span>: <span class=\"pl-s\">&#91;AUTOHEAL_CONTAINER_LABEL=autoheal&#93;   <\/span><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> label key to watch<\/span>\n    <span class=\"pl-ent\">volumes<\/span>: <span class=\"pl-s\">&#91;\"\/var\/run\/docker.sock:\/var\/run\/docker.sock\"&#93;<\/span>\n    <span class=\"pl-ent\">restart<\/span>: <span class=\"pl-s\">unless-stopped<\/span><\/pre><\/div>\n<p dir=\"auto\">\ub300\uc0c1 container \uc5d0\ub294 label \uc744 \ubd99\uc785\ub2c8\ub2e4.<\/p>\n<div class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"  temporal:\n    labels: [autoheal=true]\"><pre>  <span class=\"pl-ent\">temporal<\/span>:\n    <span class=\"pl-ent\">labels<\/span>: <span class=\"pl-s\">&#91;autoheal=true&#93;<\/span><\/pre><\/div>\n<ul dir=\"auto\">\n<li>\ub3d9\uc791: <code>AUTOHEAL_INTERVAL<\/code> (<strong>\uae30\ubcf8 5s<\/strong>) \ub9c8\ub2e4 Docker \uc5d0 \uc9c8\uc758\ud574, <strong><code>autoheal=true<\/code> label + <code>Health.Status=unhealthy<\/code><\/strong> \uc778 container \ub97c \ubaa8\ub450 \ucc3e\uc544 <code>docker restart<\/code> \ud569\ub2c8\ub2e4.<\/li>\n<li><code>AUTOHEAL_CONTAINER_LABEL<\/code> \uc740 \uac12\uc774 \ubcc0\ud558\ub294 \uac8c \uc544\ub2c8\ub77c <strong>\"\uc5b4\ub5a4 label key \ub97c \uac10\uc2dc\ud560\uc9c0\" \uc815\ud558\ub294 \uace0\uc815 \uc124\uc815<\/strong> \uc785\ub2c8\ub2e4 (\uae30\ubcf8 <code>autoheal<\/code>). <code>=all<\/code> \ub85c \ub450\uba74 label \ubb34\uad00\ud558\uac8c healthcheck \uc788\ub294 \ubaa8\ub4e0 container \ub97c \uac10\uc2dc\ud569\ub2c8\ub2e4.<\/li>\n<li>\ubc94\uc704: <code>docker.sock<\/code> \uc73c\ub85c daemon \uc804\uccb4\ub97c \ubcf4\ubbc0\ub85c <strong>\uac19\uc740 compose \ud30c\uc77c\uc774 \uc544\ub2c8\ub77c \ud638\uc2a4\ud2b8\uc758 \ubaa8\ub4e0 container<\/strong> \uac00 \ub300\uc0c1\uc785\ub2c8\ub2e4. \ub530\ub77c\uc11c <strong>\ud638\uc2a4\ud2b8\ub2f9 autoheal \uc740 \ud558\ub098\ub9cc<\/strong> \ub744\uc6b0\uace0, \uac01 stack \uc5d0 \uc911\ubcf5 \ub4f1\ub85d\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/li>\n<li>\uad00\ub828 env: <code>AUTOHEAL_START_PERIOD<\/code> (\uae30\ubcf8 0).<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">3. Docker Compose Example<\/h2><a id=\"user-content-3-docker-compose-example\" class=\"anchor\" aria-label=\"Permalink: 3. Docker Compose Example\" href=\"#3-docker-compose-example\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<div class=\"highlight highlight-source-yaml notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"services:\n  temporal:\n    image: temporalio\/auto-setup:1.25       # server is PID 1 (exec)\n    ports: [&quot;7233:7233&quot;]\n    restart: unless-stopped                  # exit \/ reboot path\n    labels: [autoheal=true]                  # hang \/ zombie path\n    healthcheck:\n      test: [&quot;CMD&quot;,&quot;temporal&quot;,&quot;operator&quot;,&quot;cluster&quot;,&quot;health&quot;,&quot;--address&quot;,&quot;localhost:7233&quot;]\n      interval: 30s\n      timeout: 10s\n      retries: 3\n\n  autoheal:                                  # one per host\n    image: willfarrell\/autoheal\n    environment: [AUTOHEAL_CONTAINER_LABEL=autoheal]\n    volumes: [&quot;\/var\/run\/docker.sock:\/var\/run\/docker.sock&quot;]\n    restart: unless-stopped\"><pre><span class=\"pl-ent\">services<\/span>:\n  <span class=\"pl-ent\">temporal<\/span>:\n    <span class=\"pl-ent\">image<\/span>: <span class=\"pl-s\">temporalio\/auto-setup:1.25       <\/span><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> server is PID 1 (exec)<\/span>\n    <span class=\"pl-ent\">ports<\/span>: <span class=\"pl-s\">&#91;\"7233:7233\"&#93;<\/span>\n    <span class=\"pl-ent\">restart<\/span>: <span class=\"pl-s\">unless-stopped                  <\/span><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> exit \/ reboot path<\/span>\n    <span class=\"pl-ent\">labels<\/span>: <span class=\"pl-s\">&#91;autoheal=true&#93;                  <\/span><span class=\"pl-c\"><span class=\"pl-c\">#<\/span> hang \/ zombie path<\/span>\n    <span class=\"pl-ent\">healthcheck<\/span>:\n      <span class=\"pl-ent\">test<\/span>: <span class=\"pl-s\">&#91;\"CMD\",\"temporal\",\"operator\",\"cluster\",\"health\",\"--address\",\"localhost:7233\"&#93;<\/span>\n      <span class=\"pl-ent\">interval<\/span>: <span class=\"pl-c1\">30s<\/span>\n      <span class=\"pl-ent\">timeout<\/span>: <span class=\"pl-c1\">10s<\/span>\n      <span class=\"pl-ent\">retries<\/span>: <span class=\"pl-c1\">3<\/span>\n\n  <span class=\"pl-ent\">autoheal<\/span>:                                  <span class=\"pl-c\"><span class=\"pl-c\">#<\/span> one per host<\/span>\n    <span class=\"pl-ent\">image<\/span>: <span class=\"pl-s\">willfarrell\/autoheal<\/span>\n    <span class=\"pl-ent\">environment<\/span>: <span class=\"pl-s\">&#91;AUTOHEAL_CONTAINER_LABEL=autoheal&#93;<\/span>\n    <span class=\"pl-ent\">volumes<\/span>: <span class=\"pl-s\">&#91;\"\/var\/run\/docker.sock:\/var\/run\/docker.sock\"&#93;<\/span>\n    <span class=\"pl-ent\">restart<\/span>: <span class=\"pl-s\">unless-stopped<\/span><\/pre><\/div>\n<ul dir=\"auto\">\n<li><strong>server crash<\/strong> \u2192 PID 1 exit \u2192 container exit \u2192 <code>restart: unless-stopped<\/code> \uac00 \ubcf5\uad6c\ud569\ub2c8\ub2e4.<\/li>\n<li><strong>server hang \/ zombie<\/strong> \u2192 healthcheck \uc2e4\ud328 \u2192 <code>Health.Status=unhealthy<\/code> \u2192 autoheal \uc774 <code>docker restart<\/code> \ub97c \uc2e4\ud589\ud569\ub2c8\ub2e4.<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 class=\"heading-element\" dir=\"auto\">Appendix A. Terminology<\/h2><a id=\"user-content-appendix-a-terminology\" class=\"anchor\" aria-label=\"Permalink: Appendix A. Terminology\" href=\"#appendix-a-terminology\"><svg data-component=\"Octicon\" class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"><\/path><\/svg><\/a><\/div>\n<ul dir=\"auto\">\n<li><strong>PID<\/strong> \u2014 process ID. Linux kernel \uc774 \uac01 process \uc5d0 \ubd80\uc5ec\ud558\ub294 \uace0\uc720 \ubc88\ud638\uc785\ub2c8\ub2e4.<\/li>\n<li><strong>PID 1<\/strong> \u2014 \uac01 PID namespace \uc758 \uccab process \uc785\ub2c8\ub2e4. container \ub294 \uc790\uccb4 PID namespace \ub97c \uac00\uc9c0\ubbc0\ub85c <code>ENTRYPOINT<\/code>\/<code>CMD<\/code> \ub85c \ub72c \uccab process \uac00 PID 1 \uc774 \ub418\uba70, PID 1 \uc774 \uc885\ub8cc\ub418\uba74 container \ub3c4 \uc885\ub8cc\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n<\/article><\/div><\/div><\/p>\n<div style='text-align:center' class='yasr-auto-insert-overall'><\/div><div style='text-align:center' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p>Two paths make a container heal itself with compose alone. A restart policy reacts to exit, meaning PID 1 died, and unless-stopped survives a reboot; a healthcheck plus the autoheal container catches the case where the container still runs but the process inside hung. Both end at docker restart.<\/p>\n","protected":false},"author":4,"featured_media":7191,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","fifu_image_url":"","fifu_image_alt":"","iawp_total_views":15,"footnotes":""},"categories":[451,10],"tags":[386],"class_list":["post-7190","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker-slug","category-software-slug","tag-github-hosted"],"yasr_visitor_votes":{"stars_attributes":{"read_only":false,"span_bottom":false},"number_of_votes":0,"sum_votes":0},"jetpack_featured_media_url":"https:\/\/ykim.synology.me\/wordpress\/wp-content\/uploads\/2026\/09\/red-apples-produce-bin.jpg","_links":{"self":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts\/7190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/comments?post=7190"}],"version-history":[{"count":1,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts\/7190\/revisions"}],"predecessor-version":[{"id":7192,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/posts\/7190\/revisions\/7192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/media\/7191"}],"wp:attachment":[{"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/media?parent=7190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/categories?post=7190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykim.synology.me\/wordpress\/wp-json\/wp\/v2\/tags?post=7190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}