首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >与ECS和EFS共享文件

问与ECS和EFS共享文件
EN

Stack Overflow用户
提问于 2020-03-03 02:02:23
回答 2查看 2.1K关注 0票数 2

你能帮帮我吗?

我正在尝试配置ECS集群以使用EFS共享文件,但我面临以下问题:

代码语言:javascript
复制
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。

按照配置片段进行操作:

代码语言:javascript
复制
  ...
  "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
    }
  ],

提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-03-31 00:27:31

我按照这些链接来解决我的问题。我认为EFS还不能在ECS中使用。

我必须在EC2中映射EFS,之后我可以从docker容器访问它。

https://gist.github.com/duluca/ebcf98923f733a1fdb6682f111b1a832#update-your-cloud-formation-template

https://xiaoyunyang.github.io/post/a-complete-guide-to-deploying-your-web-app-to-amazon-web-service/#set-up-efs-with-your-containers

票数 0
EN

Stack Overflow用户

发布于 2020-03-11 17:04:15

日志显示:“没有这样的文件或目录”:在使用之前,请确保efs上的目录存在。

其他注意事项:不能将"efsVolumeConfiguration“与ECS-Fargate一起使用。目前只支持ECS-on-EC2 (Fargate支持正在制定中)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60494298

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档