{"id":3944,"date":"2026-11-24T16:37:08","date_gmt":"2026-11-24T07:37:08","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=3944"},"modified":"2026-11-24T16:37:08","modified_gmt":"2026-11-24T07:37:08","slug":"20261123-plan099","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2026\/11\/24\/20261123-plan099\/","title":{"rendered":"Docker Compose \u306e depends_on \u3068 healthcheck \u5165\u9580\uff1a\u300c\u8d77\u52d5\u3057\u305f\u300d\u3068\u300c\u4f7f\u3048\u308b\u300d\u306f\u9055\u3046"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>Docker Compose \u3067 <code>depends_on: [db]<\/code> \u3092\u66f8\u3044\u3066\u3044\u308b\u306e\u306b\u3001\u8d77\u52d5\u76f4\u5f8c\u306b\u30a2\u30d7\u30ea\u304c DB \u63a5\u7d9a\u30a8\u30e9\u30fc\u3067\u843d\u3061\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3082\u3046\u4e00\u5ea6 <code>docker compose up<\/code> \u3059\u308b\u3068\u52d5\u304f\u3001\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3082\u591a\u3044\u3067\u3059\u3002<\/p>\n<p>\u539f\u56e0\u306f\u3001\u77ed\u3044\u66f8\u304d\u65b9\u306e <code>depends_on<\/code> \u304c\u5f85\u3064\u306e\u306f\u300c<strong>\u30b3\u30f3\u30c6\u30ca\u304c\u8d77\u52d5\u3057\u305f\u3053\u3068<\/strong>\u300d\u307e\u3067\u3067\u3001\u300c<strong>DB \u304c\u63a5\u7d9a\u3092\u53d7\u3051\u4ed8\u3051\u3089\u308c\u308b\u3053\u3068<\/strong>\u300d\u307e\u3067\u306f\u5f85\u305f\u306a\u3044\u304b\u3089\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u6b21\u306e3\u70b9\u3092\u6574\u7406\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>depends_on<\/code> \u306e\u77ed\u3044\u66f8\u304d\u65b9\u3068\u9577\u3044\u66f8\u304d\u65b9\u306e\u9055\u3044<\/li>\n<li><code>healthcheck<\/code> \u306e\u66f8\u304d\u65b9\u3068\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u610f\u5473<\/li>\n<li>2\u3064\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u300c\u672c\u5f53\u306b\u4f7f\u3048\u308b\u72b6\u614b\u300d\u307e\u3067\u5f85\u3064\u65b9\u6cd5<\/li>\n<\/ul>\n<h2>\u74b0\u5883<\/h2>\n<ul>\n<li>Docker Compose v2 \u7cfb\uff08<code>docker compose<\/code> \u30b3\u30de\u30f3\u30c9\uff09<\/li>\n<li>Compose Specification \u5f62\u5f0f\u306e <code>compose.yaml<\/code>\uff08<code>version:<\/code> \u30ad\u30fc\u306f\u4e0d\u8981\uff09<\/li>\n<\/ul>\n<p>\u203b \u65e7\u6765\u306e Compose \u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f v3 \u3067\u306f <code>depends_on<\/code> \u306e <code>condition<\/code> \u304c\u4f7f\u3048\u306a\u304b\u3063\u305f\u6642\u671f\u304c\u3042\u308a\u307e\u3059\u3002\u73fe\u5728\u306e Docker Compose v2\uff08Compose Specification\uff09\u3067\u306f\u4f7f\u3048\u307e\u3059\u3002\u53e4\u3044\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3059\u308b\u3068\u304d\u306f\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u767a\u751f\u3057\u305f\u554f\u984c<\/h2>\n<p>\u3088\u304f\u898b\u304b\u3051\u308b\u69cb\u6210\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">services:\n  app:\n    build: .\n    depends_on:\n      - db\n    environment:\n      DB_HOST: db\n\n  db:\n    image: postgres:16\n    environment:\n      POSTGRES_PASSWORD: example<\/pre>\n<p><code>docker compose up<\/code> \u3092\u5b9f\u884c\u3059\u308b\u3068\u3001<code>db<\/code> \u30b3\u30f3\u30c6\u30ca\u304c\u4f5c\u3089\u308c\u305f<strong>\u76f4\u5f8c<\/strong>\u306b <code>app<\/code> \u304c\u8d77\u52d5\u3057\u307e\u3059\u3002PostgreSQL \u306f\u521d\u56de\u8d77\u52d5\u6642\u306e\u521d\u671f\u5316\u306b\u6570\u79d2\u4ee5\u4e0a\u304b\u304b\u308b\u3053\u3068\u304c\u3042\u308a\u3001\u305d\u306e\u9593\u306b\u63a5\u7d9a\u3057\u306b\u3044\u304f\u3068\u5931\u6557\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">app-1  | connection refused (db:5432)\napp-1 exited with code 1<\/pre>\n<p>\uff08\u30a8\u30e9\u30fc\u306e\u6587\u8a00\u306f\u4f7f\u3063\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u3088\u3063\u3066\u5909\u308f\u308a\u307e\u3059\uff09<\/p>\n<h2>\u539f\u56e0<\/h2>\n<p>\u77ed\u3044\u66f8\u304d\u65b9\u306e <code>depends_on<\/code> \u306e\u610f\u5473\u306f\u300c<code>db<\/code> \u30b3\u30f3\u30c6\u30ca\u3092\u5148\u306b\u8d77\u52d5\u3057\u3066\u304b\u3089 <code>app<\/code> \u3092\u8d77\u52d5\u3059\u308b\u300d\u3067\u3059\u3002Compose \u306f\u30b3\u30f3\u30c6\u30ca\u304c\u8d77\u52d5\u3057\u305f\u6642\u70b9\u3067\u6b21\u3078\u9032\u307f\u3001<strong>\u4e2d\u306e\u30df\u30c9\u30eb\u30a6\u30a7\u30a2\u306e\u6e96\u5099\u304c\u3067\u304d\u305f\u304b\u3069\u3046\u304b\u306f\u78ba\u8a8d\u3057\u307e\u305b\u3093\u3002<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>\u72b6\u614b<\/th>\n<th>\u77ed\u3044 depends_on \u3067\u5f85\u3064\u304b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u30b3\u30f3\u30c6\u30ca\u304c\u4f5c\u3089\u308c\u3066\u8d77\u52d5\u3057\u305f<\/td>\n<td>\u2705 \u5f85\u3064<\/td>\n<\/tr>\n<tr>\n<td>DB \u30d7\u30ed\u30bb\u30b9\u304c\u63a5\u7d9a\u3092\u53d7\u3051\u4ed8\u3051\u3089\u308c\u308b<\/td>\n<td>\u274c \u5f85\u305f\u306a\u3044<\/td>\n<\/tr>\n<tr>\n<td>\u521d\u671f\u5316 SQL \u306e\u5b9f\u884c\u304c\u7d42\u308f\u3063\u305f<\/td>\n<td>\u274c \u5f85\u305f\u306a\u3044<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u300c\u6e96\u5099\u304c\u3067\u304d\u305f\u300d\u304b\u3069\u3046\u304b\u3092 Compose \u306b\u6559\u3048\u308b\u4ed5\u7d44\u307f\u304c <code>healthcheck<\/code> \u3067\u3059\u3002<\/p>\n<h2>\u5bfe\u5fdc\u65b9\u6cd5<\/h2>\n<h3>1. healthcheck \u3067\u300c\u6e96\u5099\u3067\u304d\u305f\u300d\u306e\u6761\u4ef6\u3092\u5b9a\u7fa9\u3059\u308b<\/h3>\n<pre class=\"lang:default decode:true\">  db:\n    image: postgres:16\n    environment:\n      POSTGRES_PASSWORD: example\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U postgres -h 127.0.0.1\"]\n      interval: 5s\n      timeout: 3s\n      retries: 10\n      start_period: 10s<\/pre>\n<table>\n<thead>\n<tr>\n<th>\u30ad\u30fc<\/th>\n<th>\u610f\u5473<\/th>\n<th>\u65e2\u5b9a\u5024<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>test<\/code><\/td>\n<td>\u30c1\u30a7\u30c3\u30af\u3067\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3002\u7d42\u4e86\u30b3\u30fc\u30c9 0 \u306a\u3089\u6210\u529f<\/td>\n<td>\u30a4\u30e1\u30fc\u30b8\u306e\u8a2d\u5b9a\u306b\u5f93\u3046<\/td>\n<\/tr>\n<tr>\n<td><code>interval<\/code><\/td>\n<td>\u30c1\u30a7\u30c3\u30af\u306e\u9593\u9694<\/td>\n<td>30s<\/td>\n<\/tr>\n<tr>\n<td><code>timeout<\/code><\/td>\n<td>1\u56de\u306e\u30c1\u30a7\u30c3\u30af\u306e\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8<\/td>\n<td>30s<\/td>\n<\/tr>\n<tr>\n<td><code>retries<\/code><\/td>\n<td>\u4f55\u56de\u9023\u7d9a\u3067\u5931\u6557\u3057\u305f\u3089 <code>unhealthy<\/code> \u306b\u3059\u308b\u304b<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td><code>start_period<\/code><\/td>\n<td>\u8d77\u52d5\u76f4\u5f8c\u306e\u7336\u4e88\u671f\u9593\u3002\u3053\u306e\u9593\u306e\u5931\u6557\u306f retries \u306b\u6570\u3048\u306a\u3044<\/td>\n<td>0s<\/td>\n<\/tr>\n<tr>\n<td><code>start_interval<\/code><\/td>\n<td><code>start_period<\/code> \u4e2d\u306e\u30c1\u30a7\u30c3\u30af\u9593\u9694\uff08\u65b0\u3057\u3081\u306e Engine \/ Compose \u304c\u5fc5\u8981\uff09<\/td>\n<td>5s<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u30d8\u30eb\u30b9\u72b6\u614b\u306f <code>starting<\/code> \u2192 <code>healthy<\/code> \/ <code>unhealthy<\/code> \u3068\u5909\u308f\u308a\u307e\u3059\u3002\u65e2\u5b9a\u5024\u306f30\u79d2\u9593\u9694\u306a\u306e\u3067\u3001\u958b\u767a\u7528\u306a\u3089 <code>interval<\/code> \u3092\u77ed\u3081\u306b\u3059\u308b\u306e\u304c\u5b9f\u7528\u7684\u3067\u3059\u3002<\/p>\n<h3>2. depends_on \u3092\u9577\u3044\u66f8\u304d\u65b9\u306b\u3057\u3066 condition \u3092\u4ed8\u3051\u308b<\/h3>\n<pre class=\"lang:default decode:true\">  app:\n    build: .\n    depends_on:\n      db:\n        condition: service_healthy<\/pre>\n<table>\n<thead>\n<tr>\n<th>condition<\/th>\n<th>\u5f85\u3064\u5185\u5bb9<\/th>\n<th>\u4e3b\u306a\u7528\u9014<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>service_started<\/code><\/td>\n<td>\u8d77\u52d5\u3057\u305f\uff08\u77ed\u3044\u66f8\u304d\u65b9\u3068\u540c\u3058\uff09<\/td>\n<td>\u6e96\u5099\u3092\u5f85\u305f\u306a\u304f\u3066\u3088\u3044\u4f9d\u5b58<\/td>\n<\/tr>\n<tr>\n<td><code>service_healthy<\/code><\/td>\n<td>healthcheck \u304c <code>healthy<\/code> \u306b\u306a\u3063\u305f<\/td>\n<td>DB\u30fb\u30ad\u30e3\u30c3\u30b7\u30e5\u30fbAPI \u306a\u3069<\/td>\n<\/tr>\n<tr>\n<td><code>service_completed_successfully<\/code><\/td>\n<td>\u7d42\u4e86\u30b3\u30fc\u30c9 0 \u3067\u7d42\u308f\u3063\u305f<\/td>\n<td>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u30fb\u521d\u671f\u30c7\u30fc\u30bf\u6295\u5165\u306a\u3069<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5b9f\u88c5\u4f8b<\/h2>\n<p>Web \u30a2\u30d7\u30ea + PostgreSQL + Redis + \u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u4e00\u6642\u30b3\u30f3\u30c6\u30ca\u306e\u69cb\u6210\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">services:\n  app:\n    build: .\n    environment:\n      DB_HOST: db\n      REDIS_HOST: redis\n    depends_on:\n      db:\n        condition: service_healthy\n      redis:\n        condition: service_healthy\n      migrate:\n        condition: service_completed_successfully\n    ports:\n      - \"8080:8080\"\n\n  migrate:\n    build: .\n    command: [\".\/migrate\", \"up\"]   # \u4f7f\u3063\u3066\u3044\u308b\u30c4\u30fc\u30eb\u306e\u30b3\u30de\u30f3\u30c9\u306b\u7f6e\u304d\u63db\u3048\u308b\n    environment:\n      DB_HOST: db\n    depends_on:\n      db:\n        condition: service_healthy\n\n  db:\n    image: postgres:16\n    environment:\n      POSTGRES_USER: app\n      POSTGRES_PASSWORD: example\n      POSTGRES_DB: app\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U app -d app -h 127.0.0.1\"]\n      interval: 5s\n      timeout: 3s\n      retries: 10\n      start_period: 10s\n\n  redis:\n    image: redis:7\n    healthcheck:\n      test: [\"CMD\", \"redis-cli\", \"ping\"]\n      interval: 5s\n      timeout: 3s\n      retries: 5<\/pre>\n<p>\u8d77\u52d5\u306e\u6d41\u308c:<\/p>\n<ol>\n<li><code>db<\/code> \u3068 <code>redis<\/code> \u304c\u8d77\u52d5\u3057\u3001healthcheck \u304c\u901a\u308b\u307e\u3067\u5f85\u3064<\/li>\n<li><code>db<\/code> \u304c <code>healthy<\/code> \u306b\u306a\u3063\u305f\u3089 <code>migrate<\/code> \u304c\u8d77\u52d5\u3057\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u7d42\u308f\u308b<\/li>\n<li><code>redis<\/code> \u304c <code>healthy<\/code>\u3001<code>migrate<\/code> \u304c\u6b63\u5e38\u7d42\u4e86\u306e\u4e21\u65b9\u3092\u6e80\u305f\u3057\u305f\u3089 <code>app<\/code> \u304c\u8d77\u52d5\u3059\u308b<\/li>\n<\/ol>\n<h3>MySQL \u306e\u5834\u5408<\/h3>\n<pre class=\"lang:default decode:true\">  db:\n    image: mysql:8.4\n    environment:\n      MYSQL_ROOT_PASSWORD: example\n      MYSQL_DATABASE: app\n    healthcheck:\n      test: [\"CMD-SHELL\", \"mysqladmin ping -h 127.0.0.1 -u root -p$$MYSQL_ROOT_PASSWORD\"]\n      interval: 5s\n      timeout: 3s\n      retries: 10\n      start_period: 20s<\/pre>\n<ul>\n<li><code>$$<\/code> \u306f Compose \u306e\u5909\u6570\u5c55\u958b\u3092\u907f\u3051\u308b\u305f\u3081\u306e\u30a8\u30b9\u30b1\u30fc\u30d7\u3067\u3059\u3002\u5909\u6570\u306f\u30db\u30b9\u30c8\u5074\u3067\u306f\u306a\u304f\u30b3\u30f3\u30c6\u30ca\u306e\u4e2d\u3067\u5c55\u958b\u3055\u308c\u307e\u3059\u3002<\/li>\n<li><code>-h 127.0.0.1<\/code> \u306b\u3059\u308b\u3068 TCP \u3067\u63a5\u7d9a\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002\u516c\u5f0f\u30a4\u30e1\u30fc\u30b8\u306f\u521d\u671f\u5316\u4e2d\u306b\u4e00\u6642\u30b5\u30fc\u30d0\u30fc\u3092\u52d5\u304b\u3059\u305f\u3081\u3001\u30bd\u30b1\u30c3\u30c8\u7d4c\u7531\u306e\u30c1\u30a7\u30c3\u30af\u3060\u3068\u521d\u671f\u5316\u304c\u7d42\u308f\u308b\u524d\u306b\u6210\u529f\u3057\u3066\u3057\u307e\u3046\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<h3>test \u306e\u66f8\u304d\u65b93\u7a2e<\/h3>\n<pre class=\"lang:default decode:true\"># CMD: \u30b7\u30a7\u30eb\u3092\u901a\u3055\u305a\u306b\u76f4\u63a5\u5b9f\u884c\ntest: [\"CMD\", \"redis-cli\", \"ping\"]\n\n# CMD-SHELL: \/bin\/sh -c \u7d4c\u7531\u3067\u5b9f\u884c\uff08\u30d1\u30a4\u30d7\u3084 || \u304c\u4f7f\u3048\u308b\uff09\ntest: [\"CMD-SHELL\", \"curl -fsS http:\/\/localhost:8080\/health || exit 1\"]\n\n# \u6587\u5b57\u5217: CMD-SHELL \u3068\u540c\u3058\u6271\u3044\ntest: curl -fsS http:\/\/localhost:8080\/health || exit 1<\/pre>\n<p>\u30a4\u30e1\u30fc\u30b8\u5074\u306e healthcheck \u3092\u6b62\u3081\u305f\u3044\u3068\u304d\u306f <code>disable: true<\/code>\uff08\u307e\u305f\u306f <code>test: [\"NONE\"]<\/code>\uff09\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h2>\u78ba\u8a8d\u65b9\u6cd5<\/h2>\n<pre class=\"lang:default decode:true\"># \u30d8\u30eb\u30b9\u72b6\u614b\u306e\u4e00\u89a7\uff08STATUS \u5217\u306b healthy \/ health: starting \/ unhealthy\uff09\ndocker compose ps\n\n# \u76f4\u8fd1\u306e\u30c1\u30a7\u30c3\u30af\u7d50\u679c\uff08\u7d42\u4e86\u30b3\u30fc\u30c9\u3068\u51fa\u529b\uff09\ndocker inspect --format '{{json .State.Health}}' &lt;\u30b3\u30f3\u30c6\u30ca\u540d&gt; | jq\n\n# \u5168\u30b5\u30fc\u30d3\u30b9\u304c running \/ healthy \u306b\u306a\u308b\u307e\u3067\u5f85\u3063\u3066\u304b\u3089\u623b\u308b\uff08CI \u5411\u304d\uff09\ndocker compose up -d --wait<\/pre>\n<h2>\u6ce8\u610f\u70b9<\/h2>\n<h3>healthcheck \u306e\u30b3\u30de\u30f3\u30c9\u306f\u30a4\u30e1\u30fc\u30b8\u306b\u5165\u3063\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308b<\/h3>\n<p><code>curl<\/code> \u3084 <code>wget<\/code> \u306f\u8efd\u91cf\u30a4\u30e1\u30fc\u30b8\uff08alpine \u7cfb\u30fbdistroless \u306a\u3069\uff09\u306b\u5165\u3063\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u30b3\u30de\u30f3\u30c9\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u3068\u30c1\u30a7\u30c3\u30af\u306f\u5931\u6557\u3057\u7d9a\u3051\u3001\u4f9d\u5b58\u5148\u306f\u6c38\u9060\u306b\u8d77\u52d5\u3057\u307e\u305b\u3093\u3002<\/p>\n<h3>unhealthy \u306b\u306a\u308b\u3068\u4f9d\u5b58\u5074\u306f\u8d77\u52d5\u3057\u306a\u3044<\/h3>\n<pre class=\"lang:default decode:true\">dependency failed to start: container xxx-db-1 is unhealthy<\/pre>\n<p><code>retries<\/code> \u3084 <code>start_period<\/code> \u304c\u77ed\u3059\u304e\u308b\u3068\u3001\u521d\u671f\u5316\u304c\u9045\u3044\u74b0\u5883\uff08\u521d\u56de\u8d77\u52d5\u30fbCI \u306a\u3069\uff09\u3060\u3051\u3067\u5931\u6557\u3059\u308b\u3001\u3068\u3044\u3046\u518d\u73fe\u3057\u306b\u304f\u3044\u554f\u984c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>depends_on \u306f\u300c\u8d77\u52d5\u6642\u300d\u306e\u9806\u756a\u3057\u304b\u9762\u5012\u3092\u898b\u306a\u3044<\/h3>\n<p>\u8d77\u52d5\u5f8c\u306b DB \u304c\u518d\u8d77\u52d5\u3057\u305f\u308a\u3001\u4e00\u6642\u7684\u306b\u63a5\u7d9a\u304c\u5207\u308c\u305f\u308a\u3057\u305f\u5834\u5408\u3001<code>depends_on<\/code> \u306f\u52a9\u3051\u3066\u304f\u308c\u307e\u305b\u3093\u3002\u30a2\u30d7\u30ea\u5074\u306b\u3082\u63a5\u7d9a\u30ea\u30c8\u30e9\u30a4\u3092\u5165\u308c\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002DB \u306e\u518d\u8d77\u52d5\u306b\u5408\u308f\u305b\u3066\u30a2\u30d7\u30ea\u3082\u518d\u8d77\u52d5\u3057\u305f\u3044\u5834\u5408\u306f\u3001<code>restart: true<\/code> \u3092\u4ed8\u3051\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\uff08\u65b0\u3057\u3081\u306e Compose \u3067\u5229\u7528\u53ef\u80fd\uff09\u3002<\/p>\n<pre class=\"lang:default decode:true\">depends_on:\n  db:\n    condition: service_healthy\n    restart: true<\/pre>\n<h3>unhealthy \u3067\u3082\u81ea\u52d5\u3067\u518d\u8d77\u52d5\u306f\u3055\u308c\u306a\u3044<\/h3>\n<p>\u7d20\u306e Docker \/ Compose \u3067\u306f\u3001<code>unhealthy<\/code> \u306b\u306a\u3063\u305f\u3060\u3051\u3067\u30b3\u30f3\u30c6\u30ca\u304c\u518d\u8d77\u52d5\u3055\u308c\u308b\u3053\u3068\u306f\u3042\u308a\u307e\u305b\u3093\uff08Swarm \u30e2\u30fc\u30c9\u3068\u306f\u52d5\u304d\u304c\u9055\u3044\u307e\u3059\uff09\u3002healthcheck \u306f\u300c\u72b6\u614b\u3092\u5224\u5b9a\u3059\u308b\u3082\u306e\u300d\u3067\u3042\u308a\u3001\u300c\u81ea\u52d5\u3067\u56de\u5fa9\u3055\u305b\u308b\u3082\u306e\u300d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>\u77ed\u3044\u66f8\u304d\u65b9\u306e <code>depends_on<\/code> \u306f<strong>\u8d77\u52d5\u306e\u9806\u756a<\/strong>\u3057\u304b\u4fdd\u8a3c\u3057\u306a\u3044<\/li>\n<li>\u300c\u4f7f\u3048\u308b\u72b6\u614b\u300d\u307e\u3067\u5f85\u3064\u306b\u306f <code>healthcheck<\/code> \u3068 <code>condition: service_healthy<\/code> \u3092\u7d44\u307f\u5408\u308f\u305b\u308b<\/li>\n<li>\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u306f <code>service_completed_successfully<\/code><\/li>\n<li>\u9593\u9694\u30fb\u30ea\u30c8\u30e9\u30a4\u56de\u6570\u30fb\u7336\u4e88\u671f\u9593\u306f\u3001\u521d\u671f\u5316\u304c\u9045\u3044\u74b0\u5883\u3092\u524d\u63d0\u306b\u4f59\u88d5\u3092\u6301\u305f\u305b\u308b<\/li>\n<li>\u8d77\u52d5\u5f8c\u306e\u63a5\u7d9a\u5207\u308c\u306f\u30a2\u30d7\u30ea\u5074\u306e\u30ea\u30c8\u30e9\u30a4\u3067\u5bfe\u5fdc\u3059\u308b<\/li>\n<\/ul>\n<p>\u300c\u8d77\u52d5\u3057\u305f\u300d\u3068\u300c\u4f7f\u3048\u308b\u300d\u306f\u9055\u3046\u3001\u3068\u3044\u3046\u70b9\u3092\u62bc\u3055\u3048\u3066\u304a\u3051\u3070\u3001\u8d77\u52d5\u76f4\u5f8c\u306e\u63a5\u7d9a\u30a8\u30e9\u30fc\u306e\u591a\u304f\u306f\u3053\u306e\u4ed5\u7d44\u307f\u3067\u89e3\u6d88\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker Compose \u3067 dependson: [db] \u3092\u66f8\u3044\u3066\u3044\u308b\u306e\u306b\u3001\u8d77\u52d5\u76f4\u5f8c\u306b\u30a2\u30d7\u30ea\u304c DB \u63a5\u7d9a\u30a8\u30e9\u30fc\u3067\u843d\u3061\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3082\u3046\u4e00\u5ea6 docker compose up \u3059\u308b\u3068\u52d5\u304f\u3001\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3082\u591a\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":3943,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_lightning_design_setting":[],"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[75],"tags":[498,1198,154,410,1162],"class_list":["post-3944","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-of-serverside","tag-docker","tag-postgresql","tag-154","tag-410","tag-1162"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2026\/11\/20261123-plan099-thumbnail.jpg","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=3944"}],"version-history":[{"count":1,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3944\/revisions"}],"predecessor-version":[{"id":3951,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/3944\/revisions\/3951"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/3943"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=3944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=3944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=3944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}