与 ECS 和 EFS 共享文件
Sharing files with ECS and EFS
你能帮帮我吗?
我正在尝试配置 ECS 集群以使用 EFS 共享文件,但我遇到了以下问题:
level=info time=2020-03-02T17:30:27Z msg="TaskHandler: Sending task change: TaskChange:
[arn:aws:ecs:us-east-1:959242800104:task/74086a36-c405-4248-8475-3234b011bee8 -> STOPPED, Known
Sent: NONE, PullStartedAt: 2020-03-02 17:30:27.661062367 +0000 UTC m=+3131.201879282,
PullStoppedAt: 2020-03-02 17:30:27.744492758 +0000 UTC m=+3131.285309673, ExecutionStoppedAt:
2020-03-02 17:30:27.913073824 +0000 UTC m=+3131.453890739,
arn:aws:ecs:us-east-1:959242800104:task/74086a36-c405-4248-8475-3234b011bee8 redmine -> STOPPED, Reason
CannotCreateContainerError: Error response from daemon: failed to mount local volume: mount
:/mnt/efs/redmine:/var/lib/docker/volumes/ecs-redmine-22-attachments-cee2f0e7e0ebc5f55000/_data,
data: addr=10.0.0.127,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport:
no such file or directory, Known Sent: NONE] sent: false" module=task_handler_types.go
如果我只在我的 ECS 任务中声明一个卷,容器会正常启动,但如果我尝试将外部卷映射到容器文件夹,就会出现问题。
我遵循了本教程:https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_efs.html 看来问题不在安全组中,而是容器本身。
我正在使用 Redmine 的高山版本。
遵循配置片段:
...
"mountPoints": [
{
"readOnly": null,
"containerPath": "/usr/src/redmine/files",
"sourceVolume": "attachments"
}
],
...
"volumes": [
{
"efsVolumeConfiguration": {
"fileSystemId": "fs-xxxxx",
"rootDirectory": "/mnt/efs/redmine"
},
"name": "attachments",
"host": null,
"dockerVolumeConfiguration": null
}
],
提前致谢。
日志显示:"no such file or directory":使用前确保 efs 上的目录存在。
其他注意事项:
您不能将 "efsVolumeConfiguration" 与 ECS-Fargate 一起使用。目前仅适用于 ECS-on-EC2(Fargate 支持正在制作中)。
我点击了这些链接以解决我的问题。我以为 EFS 还没有准备好在 ECS 中使用。
我必须将 EFS 映射到 EC2 中,然后我可以从 docker 容器访问。
https://gist.github.com/duluca/ebcf98923f733a1fdb6682f111b1a832#update-your-cloud-formation-template
你能帮帮我吗?
我正在尝试配置 ECS 集群以使用 EFS 共享文件,但我遇到了以下问题:
level=info time=2020-03-02T17:30:27Z msg="TaskHandler: Sending task change: TaskChange:
[arn:aws:ecs:us-east-1:959242800104:task/74086a36-c405-4248-8475-3234b011bee8 -> STOPPED, Known
Sent: NONE, PullStartedAt: 2020-03-02 17:30:27.661062367 +0000 UTC m=+3131.201879282,
PullStoppedAt: 2020-03-02 17:30:27.744492758 +0000 UTC m=+3131.285309673, ExecutionStoppedAt:
2020-03-02 17:30:27.913073824 +0000 UTC m=+3131.453890739,
arn:aws:ecs:us-east-1:959242800104:task/74086a36-c405-4248-8475-3234b011bee8 redmine -> STOPPED, Reason
CannotCreateContainerError: Error response from daemon: failed to mount local volume: mount
:/mnt/efs/redmine:/var/lib/docker/volumes/ecs-redmine-22-attachments-cee2f0e7e0ebc5f55000/_data,
data: addr=10.0.0.127,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport:
no such file or directory, Known Sent: NONE] sent: false" module=task_handler_types.go
如果我只在我的 ECS 任务中声明一个卷,容器会正常启动,但如果我尝试将外部卷映射到容器文件夹,就会出现问题。
我遵循了本教程:https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_efs.html 看来问题不在安全组中,而是容器本身。
我正在使用 Redmine 的高山版本。
遵循配置片段:
...
"mountPoints": [
{
"readOnly": null,
"containerPath": "/usr/src/redmine/files",
"sourceVolume": "attachments"
}
],
...
"volumes": [
{
"efsVolumeConfiguration": {
"fileSystemId": "fs-xxxxx",
"rootDirectory": "/mnt/efs/redmine"
},
"name": "attachments",
"host": null,
"dockerVolumeConfiguration": null
}
],
提前致谢。
日志显示:"no such file or directory":使用前确保 efs 上的目录存在。
其他注意事项: 您不能将 "efsVolumeConfiguration" 与 ECS-Fargate 一起使用。目前仅适用于 ECS-on-EC2(Fargate 支持正在制作中)。
我点击了这些链接以解决我的问题。我以为 EFS 还没有准备好在 ECS 中使用。
我必须将 EFS 映射到 EC2 中,然后我可以从 docker 容器访问。
https://gist.github.com/duluca/ebcf98923f733a1fdb6682f111b1a832#update-your-cloud-formation-template