#amazon-web-services #docker #amazon-elastic-beanstalk
#amazon-web-services #docker #amazon-elastic-beanstalk
Вопрос:
Контейнеры docker, которые я развертываю на экземпляре beanstalk, похоже, не запускаются успешно. Существует не так много информации, показывающей, ПОЧЕМУ это не удалось…
Вот мой Dockerrun.aws.json:
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"essential": true,
"name": "api",
"image": "<user>/<repo>:latest",
"memory": 256,
"portMappings": [
{
"containerPort": 8000,
"hostPort": 8000
}
]
},
{
"essential": true,
"image": "postgres:latest",
"memory": 256,
"mountPoints": [
{
"containerPath": "/var/lib/postgresql/data/",
"sourceVolume": "Postgres_Data"
}
],
"name": "db"
},
{
"essential": true,
"image": "nginx:latest",
"mountPoints": [
{
"containerPath": "/etc/nginx/conf.d",
"sourceVolume": "_Nginx"
}
],
"name": "nginx",
"memory": 256,
"portMappings": [
{
"containerPort": 443,
"hostPort": 443
},
{
"containerPort": 80,
"hostPort": 80
}
]
}
],
"family": "",
"volumes": [
{
"host": {
"sourcePath": "postgres_data"
},
"name": "Postgres_Data"
},
{
"host": {
"sourcePath": "nginx"
},
"name": "_Nginx"
}
]
}
Часть журнала ошибок ( eb logs
). В журналах даже нет частей level = warn или level = error, что делает это еще более запутанным.
[2020-08-16T08:51:08.224Z] INFO [4078] - [Application deployment app-200816_014520@1/StartupStage1/AppDeployEnactHook/02update-credentials.sh] : Starting activity...
[2020-08-16T08:51:08.426Z] INFO [4078] - [Application deployment app-200816_014520@1/StartupStage1/AppDeployEnactHook/02update-credentials.sh] : Completed activity.
[2020-08-16T08:51:08.426Z] INFO [4078] - [Application deployment app-200816_014520@1/StartupStage1/AppDeployEnactHook/03start-task.sh] : Starting activity...
[2020-08-16T08:52:11.081Z] INFO [4078] - [Application deployment app-200816_014520@1/StartupStage1/AppDeployEnactHook/03start-task.sh] : Activity execution failed, because: . /opt/elasticbeanstalk/hooks/common.sh
RETRY=0
initctl start eb-ecs EB_EVENT_FILE=/tmp/eventsfile20200816-4078-1yuoqug
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/eventsfile20200816-4078-1yuoqug
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/eventsfile20200816-4078-1yuoqug
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/eventsfile20200816-4078-1yuoqug
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)
Как это исправить? Спасибо!
Комментарии:
1. Возможно, можно попробовать запустить базовый пример контейнера docker, например, этот . Как только это заработает, вы можете продолжить это упражнение и узнать, как запустить ваше пользовательское изображение?