0

I am using terraform to build infrastructure on AWS provider. I am using ECR to push my local docker images using AWSCLI.

Now, I have a Application load balancer which would route traffic to ECS_service. I want ECS to manage my Docker Containers using Fargate. But, the docker containers are exited by saying "Essential Docker container exited".

Thats the only log printed out.

If i change the docker image to be nginx:latest(which is fetched from dockerhub). It works.

PS: My docker container is a simple node application with node:alpine as base image. Is it something related to this, i am wrong !

Can anyone provide me with some insight on what is wrong with my approach.

I get the following error in AWS Logs: docker-standard-init-linux-go211-exec-user-process-caused-exec-format-error.

My Dockerfile

FROM node:alpine

WORKDIR /app

COPY . .

RUN npm install

# Expose a port.
EXPOSE 8080

# Run the node server.
ENTRYPOINT ["npm", "start"]

They say, its issue with the start script. I am just running this command. npm start to start the server.

Waseem
  • 69
  • 11
  • can you turn on logging for this and share the logs information? [Amazon ECS troubleshooting](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/troubleshooting.html) has pretty good information on how to debug for errors. – samtoddler Mar 19 '21 at 08:53
  • I have edited the question with the log. Kindly let me know, if you find something wrong. Thanks for the reply. – Waseem Mar 22 '21 at 05:26
  • can you add `#!/usr/bin/env node` to your app and try running the image locally like `docker run -it sh` if that works? It might be the case some extension which was not compiled for `linux` you might be trying to load in your app, that's why the error is for `exec format`. It works with nginx because the `entrypoint` is different for both images. – samtoddler Mar 22 '21 at 09:09

1 Answers1

0

It’s not your approach, your image is just not working. Try running it locally and see the output otherwise you will need to ship the logs to Cloudwatch and see what they say