AWS Multi-docker在任务退出时部署Essential容器

时间:2017-07-11 13:16:55

标签: php amazon-web-services nginx

我在将本地docker配置部署到AWS时出现此问题:

  

错误:ECS任务因以下原因而停止:任务中的基本容器已退出。 (BENJ-elasticsearch:   BENJ-nginx的:   benj-php-fpm:)

错误日志:

+ 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)

一些评论:

所以我有我的本地docker-compose.yml。我将它移植到Dockerrun.aws.js但因为我使用自己的容器(bensji / php-fpm),我不得不将该容器部署到云端。

这些是我的档案: Dockerrun.aws.js

{
"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
      }
    ]
  }
]

}

谢谢。

0 个答案:

没有答案