0

My Fargate task keeps stopping after it's started and doesn't output any logs (awslog driver is selected). enter image description here

The container does start up and stay running when i execute docker locally.

Docker-compose file:

version: '2'
services:
  asterisk:
    build: .
    container_name: asterisk
    restart: always
    ports:
      - 10000-10099:10000-10099/udp
      - 5060:5060/udp

Dockerfile:

FROM debian:10.7

RUN {stuff-that-works-is-here}


# Keep Asterisk running in the foreground
ENTRYPOINT ["asterisk", "-f"]

# SIP port 
EXPOSE 5060:5060/udp

# RTP ports
EXPOSE 10000-10099:10000-10099/udp

my task execution role has full cloudwatch access for debugging.

aphexlog
  • 1,503
  • 3
  • 16
  • 43

3 Answers3

0

Click on the ECS task instance, expand the container section, the error should be shown there. I have attached a screen shot of it. Here is a screenshotScrenshot

Hari
  • 16
  • 1
  • `Stopped reason: Essential container in task exited` & i also see `exit code 132` if I expand the dropdown under container. – aphexlog Jan 26 '21 at 22:37
  • It seems similar to this issue, a Reddit thread on that [https://www.reddit.com/r/docker/comments/bltx02/container_exits_with_132_with_no_logs/](https://www.reddit.com/r/docker/comments/bltx02/container_exits_with_132_with_no_logs/) – Hari Jan 26 '21 at 23:16
0

The AWS log driver alone is not enough. Unfortunately, Fargate doesn't create the log group for you unless you tell it to

See Creating a log group at https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html

Stefan
  • 747
  • 8
  • 11
0

I had a similar problem, and the cause was the Health Check.

ECS dont have Health Check for UDP, so when you open a UDP port if you use Docker for the deploy (docker compose), it create a Health Check pointing to a TCP port, and since there was no open TCP ports for that range, the container reset itself due to Health Check.

I had to add a custom Resource to docker-compose:

x-aws-cloudformation:
  Resources:
    AsteriskUDP5060TargetGroup:
      Type: "AWS::ElasticLoadBalancingV2::TargetGroup"
      Properties:
        HealthCheckProtocol: TCP
        HealthCheckPort: 8088

Basically I have a Health Check for a UDP port pointing to a TCP port. Its a "hack" to bypass this problem when the deploy is made with Docker.