amazon-web-services - 容器 ECS EC2 未以`running exec setns process for init 开头导致 \"exit status 23\"": unknown`
问题描述
尝试在支持 EC2 的 AWS ECS 上运行 hello-world 容器时出现以下错误:
CannotStartContainerError: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:301: running exec setns process for init caused \"exit status 23\"": unknown
我的 dockerfile 看起来像:
FROM ubuntu:18.04
# Install dependencies
RUN apt-get update && \
apt-get -y install apache2
# Install apache and write hello world message
RUN echo 'Hello World!' > /var/www/html/index.html
# Configure apache
RUN echo '. /etc/apache2/envvars' > /root/run_apache.sh && \
echo 'mkdir -p /var/run/apache2' >> /root/run_apache.sh && \
echo 'mkdir -p /var/lock/apache2' >> /root/run_apache.sh && \
echo '/usr/sbin/apache2 -D FOREGROUND' >> /root/run_apache.sh && \
chmod 755 /root/run_apache.sh
EXPOSE 80
CMD /root/run_apache.sh
和我的任务定义:
{
"ipcMode": null,
"executionRoleArn": null,
"containerDefinitions": [
{
"dnsSearchDomains": null,
"logConfiguration": null,
"entryPoint": null,
"portMappings": [
{
"hostPort": 0,
"protocol": "tcp",
"containerPort": 80
}
],
"command": null,
"linuxParameters": null,
"cpu": 0,
"environment": [
{
"name": "ENVIRONMENT",
"value": "qa"
},
{
"name": "SOFTWARE_VERSION",
"value": "28"
}
],
"resourceRequirements": null,
"ulimits": null,
"dnsServers": null,
"mountPoints": [],
"workingDirectory": null,
"secrets": null,
"dockerSecurityOptions": null,
"memory": null,
"memoryReservation": null,
"volumesFrom": [],
"stopTimeout": null,
"image": "docker.foobar.com/hello-ecs:28",
"startTimeout": null,
"dependsOn": null,
"disableNetworking": null,
"interactive": null,
"healthCheck": null,
"essential": true,
"links": [],
"hostname": null,
"extraHosts": null,
"pseudoTerminal": null,
"user": null,
"readonlyRootFilesystem": null,
"dockerLabels": {
"owner": "shared-infrastructure",
"environment": "qa",
"awsCostCenter": "shared-infrastructure",
"software_version": "28"
},
"systemControls": null,
"privileged": null,
"name": "hello-ecs"
}
],
"placementConstraints": [],
"memory": "4",
"taskRoleArn": "arn:aws:iam::123456789:role/hello-ecs-qa-task-role",
"compatibilities": [
"EC2"
],
"taskDefinitionArn": "arn:aws:ecs:eu-west-1:123456789:task-definition/hello-ecs-qa:27",
"family": "hello-ecs-qa",
"requiresAttributes": [
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.task-iam-role"
},
{
"targetId": null,
"targetType": null,
"value": null,
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
}
],
"pidMode": null,
"requiresCompatibilities": [
"EC2"
],
"networkMode": "bridge",
"cpu": "128",
"revision": 27,
"status": "ACTIVE",
"inferenceAccelerators": null,
"proxyConfiguration": null,
"volumes": []
}
容器实例是:
Agent version 1.30.0
Docker version 18.06.1-ce
有什么想法可以解决或调试这个问题吗?谢谢
解决方案
我从工作任务定义向后工作,罪魁祸首原来是"memory": "4",
将此更改为"memory": "256"
,导致任务成功启动。
推荐阅读
- php - 在 Laravel API 响应中循环所有数据
- php - WordPress | 循环不同的col-md
- python - 如何将 .csv 文件与 python 合并?
- wordpress - 我可以通过独立工具在 WordPress 中插入帖子吗
- audio - stm32 SD卡混音
- java - 我不明白为什么 test[number-1] 重复并返回不同的布尔值
- apache-kafka - 两个 kafkaTemplate 对象之间的动态切换
- c++ - 嵌套可移动对象的 std::containers
- r - Highcharts/highcharteR 在绘制 50+ 系列时忽略点颜色
- android - 如何限制其他人登录我的应用程序?