我在我的单个容器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.
原文链接:https://www.f2er.com/docker/436800.html这是一个例子,.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"