0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ECS のヘルスチェックでタスクが落ち続けた原因は「curl 不在」だった話

Last updated at Posted at 2025-09-02

ECS のヘルスチェックでタスクが落ち続けた原因は「curl 不在」だった話(要約)

AWS Fargate 環境でヘルスチェックが失敗し、タスクが再起動ループに陥ったときの原因と対処法をまとめました。


TL;DR

  • Fargate タスク定義の healthCheck.commandcurl を使っていたが、
    ベースイメージ node:22-alpine には curl が含まれていなかった。
  • コマンド実行自体が失敗 → ECS が Unhealthy 判定 → 無限再起動。
  • apk add --no-cache curl で解決、または Node.js の fetch に置き換えも可。

詳細・再発防止策

この要約では概要のみを紹介しています。
設定例・Dockerfile修正版・Node.jsの代替ヘルスチェック実装コードなど、より詳しい手順・原因分析は以下の記事で解説しています👇

👉 本記事の詳細版はこちら
https://s-soya.tech/blog/ecs-healthcheck-curl


📘 まとめ

ALB のヘルスチェックが緑でも、ECS のタスク定義側で失敗していると容赦なく再起動される。
軽量イメージを使うときは「入っているもの・いないもの」をちゃんと棚卸ししておこう。


✍️ 著者
Soya — Engineer Portfolio
(Next.js + Tailwind CSS で構築したポートフォリオサイトです)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?