结合使用AWS EFS和Docker [英] Using AWS EFS with Docker

查看:185
本文介绍了结合使用AWS EFS和Docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单个容器EB部署中使用了Amazon提供的新的Elastic File System.我无法弄清楚为什么无法将已挂载的EFS映射到容器中.

I am using the new Elastic File System provided by amazon, on my single container EB deploy. I can't figure out why the mounted EFS cannot be mapped into the container.

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

The EFS mount is successfully performed on the host at /efs-mount-point.

提供给Dockerrun.aws.json的是

Provided to the Dockerrun.aws.json is

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

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

The volume is then created in the container once it starts running. However it has mapped the hosts directory /efs-mount-point, not the actual EFS mount point. I can't figure out how to get Docker to map in the EFS volume mounted at /efs-mount-point instead of the host's directory.

NFS卷可以在Docker上很好地发挥作用吗?

Do NFS volumes play nice with Docker?

推荐答案

您需要重启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"

这篇关于结合使用AWS EFS和Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆