加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

amazon-web-services – 将AWS EFS与Docker配合使用

发布时间:2020-12-16 03:37:02 所属栏目:安全 来源:网络整理
导读:我在我的单个容器EB部署中使用亚马逊提供的新弹性文件系统.我无法弄清楚为什么挂载的EFS无法映射到容器中. EFS挂载已在/ efs-mount-point上的主机上成功执行. 提供给Dockerrun.aws.json是 { "AWSEBDockerrunVersion": "1" "Volumes": [ { "HostDirectory": "

我在我的单个容器EB部署中使用亚马逊提供的新弹性文件系统.我无法弄清楚为什么挂载的EFS无法映射到容器中.

EFS挂载已在/ efs-mount-point上的主机上成功执行.

提供给Dockerrun.aws.json是

{
  "AWSEBDockerrunVersion": "1"
  "Volumes": [
    {
      "HostDirectory": "/efs-mount-point","ContainerDirectory": "/efs-mount-point"
    }
  ]
}

然后,一旦卷开始运行,就会在容器中创建卷.但是它已映射hosts目录/ efs-mount-point,而不是实际的EFS挂载点.我无法弄清楚如何让Docker映射到安装在/ efs-mount-point而不是主机目录的EFS卷中.

NFS卷与Docker一起玩得好吗?

最佳答案
将EFS卷安装到主机EC2实例后,需要restart docker.

这是一个例子,.ebextensions / efs.config:

commands:
   01mkdir:
      command: "mkdir -p /efs-mount-point"
   02mount:
      command: "mountpoint -q /efs-mount-point || mount -t nfs4 -o nfsvers=4.1 $(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-fa35c253.efs.us-west-2.amazonaws.com:/ /efs-mount-point"
   03restart:
      command: "service docker restart"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读