title: AWS Multi-docker deploy Essential container in task exited
body: <p>I'm having this problem on deploying my local docker config to AWS:</p>
  
  <blockquote>
    <p>ERROR: ECS task stopped due to: Essential container in task exited. (benj-elasticsearch:
    benj-nginx:
    benj-php-fpm: )</p>
  </blockquote>
  
  <p>The error log:</p>
  
  <pre><code>+ RETRY=0
  + initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20170711-9737-o42dsc
  initctl: Job failed to start
  + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']'
  + warn 'Failed to start ECS task, retrying...'
  + echo 'Failed to start ECS task, retrying...'
  Failed to start ECS task, retrying...
  + eventHelper.py --msg 'Failed to start ECS task, retrying...' --severity WARN
  + RETRY=1
  + sleep 3
  + '[' 1 -gt 1 ']'
  + initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20170711-9737-o42dsc
  initctl: Job failed to start
  + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']'
  + warn 'Failed to start ECS task, retrying...'
  + echo 'Failed to start ECS task, retrying...'
  Failed to start ECS task, retrying...
  + eventHelper.py --msg 'Failed to start ECS task, retrying...' --severity WARN
  + RETRY=2
  + sleep 3
  + '[' 2 -gt 1 ']'
  + error_exit 'Failed to start ECS task after retrying 2 times.' 1
  + error 'Failed to start ECS task after retrying 2 times.'
  + echo 'Failed to start ECS task after retrying 2 times.'
  Failed to start ECS task after retrying 2 times.
  + eventHelper.py --msg 'Failed to start ECS task after retrying 2 times.' --severity ERROR
  + exit 1 (ElasticBeanstalk::ExternalInvocationError)
  caused by: + . /opt/elasticbeanstalk/hooks/common.sh
  + RETRY=0
  + initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20170711-9737-o42dsc
  initctl: Job failed to start
  + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']'
  + warn 'Failed to start ECS task, retrying...'
  + echo 'Failed to start ECS task, retrying...'
  Failed to start ECS task, retrying...
  + eventHelper.py --msg 'Failed to start ECS task, retrying...' --severity WARN
  + RETRY=1
  + sleep 3
  + '[' 1 -gt 1 ']'
  + initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20170711-9737-o42dsc
  initctl: Job failed to start
  + '[' -f /etc/elasticbeanstalk/.eb-ecs-start-no-retry ']'
  + warn 'Failed to start ECS task, retrying...'
  + echo 'Failed to start ECS task, retrying...'
  Failed to start ECS task, retrying...
  + eventHelper.py --msg 'Failed to start ECS task, retrying...' --severity WARN
  + RETRY=2
  + sleep 3
  + '[' 2 -gt 1 ']'
  + error_exit 'Failed to start ECS task after retrying 2 times.' 1
  + error 'Failed to start ECS task after retrying 2 times.'
  + echo 'Failed to start ECS task after retrying 2 times.'
  Failed to start ECS task after retrying 2 times.
  + eventHelper.py --msg 'Failed to start ECS task after retrying 2 times.' --severity ERROR
  + exit 1 (Executor::NonZeroExitStatus)
  </code></pre>
  
  <p>Some remarks:</p>
  
  <p>So I have my local docker-compose.yml. I ported this to the Dockerrun.aws.js BUT because I use my own container (bensji/php-fpm), I had to deploy that container to the cloud.</p>
  
  <p>These are my files:
  Dockerrun.aws.js</p>
  
  <pre><code>{
  "AWSEBDockerrunVersion": 2,
  "volumes": [
    {
      "name": "benj",
      "host": {
        "sourcePath": "/var/app/current"
      }
    },
    {
      "name": "fpmconf",
      "host": {
        "sourcePath": "/var/app/current/docker/production/php-fpm"
      }
    },
    {
      "name": "nginxconf",
      "host": {
        "sourcePath": "/var/app/current/docker/production/nginx"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "benj-nginx",
      "image": "phpdockerio/nginx:latest",
      "essential": true,
      "memory": 128,
      "environment": [
        {
          "name": "Container",
          "value": "nginx"
        }
      ],
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 80
        }
      ],
      "links": [
        "benj-php-fpm"
      ],
      "mountPoints": [
        {
          "sourceVolume": "benj",
          "containerPath": "/var/www/benj",
          "readOnly": true
        },
        {
          "sourceVolume": "nginxconf",
          "containerPath": "/usr/local/nginx/conf",
          "readOnly": true
        }
      ]
    },
    {
      "name": "benj-php-fpm",
      "image": "bensji/php-fpm:latest",
      "environment": [
        {
          "name": "Container",
          "value": "php-fpm"
        }
      ],
      "essential": true,
      "memory": 128,
      "mountPoints": [
        {
          "sourceVolume": "benj",
          "containerPath": "/var/www/benj"
        },
        {
          "sourceVolume": "fpmconf",
          "containerPath": "/usr/local/php/etc",
          "readOnly": true
        }
      ]
    },
    {
      "name": "benj-elasticsearch",
      "image": "docker.elastic.co/elasticsearch/elasticsearch:5.4.0",
      "environment": [
        {
          "name": "Container",
          "value": "elasticsearch"
        }
      ],
      "memory": 128,
      "portMappings": [
        {
          "hostPort": 9200,
          "containerPort": 9200
        }
      ]
    }
  ]
  </code></pre>
  
  <p>}</p>
  
  <p>Thank you.</p>