aws / aws/containers-roadmap

[Fargate] Nodejs container unable to start with error Command failed with signal "SIGTERM" with fargate version 1.4.0

Open
#2,116 1 comment 2 reactions 0 assignees View on GitHub
Fargate
Dominant language
Shell
Stars
5.4k
Forks
334
PR merge metrics
No merged PRs in 30d

Description

Nodejs application failed to start on ECS Fargate version 1.4.0.
When we are deploying the nodejs application to the ECS Fargate version 1.4.0 platform then we are getting the error **Command failed with signal "SIGTERM"** due to which container also failed to sustain running status.
![image](https://github.com/aws/containers-roadmap/assets/118334638/e1d31f55-b928-4c87-9031-907c6c29d14b)

But when we deploy to ECS Fargate 1.3.0 the application is able to start and the container gets into running status.

**Dockerfile**
```
# Do the npm install or yarn install in the full image
FROM node:16.3-alpine3.13 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:16.3-alpine3.13 AS builder
WORKDIR /app
COPY --from=deps /app ./
RUN yarn build

# Production image, copy all the files and run next
FROM node:16.3-alpine3.13 AS runner
WORKDIR /app

ENV NODE_ENV production

# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app ./

EXPOSE 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# RUN npx next telemetry disable

CMD ["yarn", "start", "app", "--prod", "--port=3000"]
```
Even though we have changed the nodejs image to node:18.17-alpine3.18 but it still gives the same error. Around 10 days back same application was running fine on Fargate 1.4.0

Contributor guide

Open the contributing guide

Research direction

Start with the supplied Dockerfile and compare the ECS task definition, container command, and Fargate 1.3.0 versus 1.4.0 task events and logs. Reproduce the SIGTERM on the stated Node.js images, then determine whether the failure is caused by the application configuration or Fargate and document a confirmed diagnosis or workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, nodejs
Domain
cloud, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.