task wont stay running on Amazon EC2

I followed this tutorial:

I created a simple helloworld 5 web application. I then created a Docker image and pushed it to Docker Hub:

  • Docker or Docker for AWS and Deployment on AWS EC2
  • How to send requests to a web server running inside a docker container inside an AWS EC2 machine from the outside world?
  • Dokku Port configuration problems EC2
  • Airbnb Airflow using all system resources
  • slow pg_restore on docker container startup
  • Will single docker container scale automatically on Amazon's EC2?
  • I then created an Amazon EC2 cluster using my Docker image and the task won’t stay running.

    If I look at the task it says the stopped reason is : Essential container in task exited.

    I am very new to EC2 and Docker so any help would be appreciated.

  • Is it possible to scp/git push from my local machine to docker container hosted in AWS?
  • Specify runtime for self container .Net Core app in Docker
  • How can I connect my autoscaling group to my ecs cluster?
  • Getting Started with EC2 Container Registry
  • Starting a barebones MVC C# ASP.NET project in Docker gives “Compilation Error”
  • Docker Daemon startup error using clustering in AWS
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.