Hi. I've isolated a scenario where the EFS mount type helper fails to create a docker volume, yet using the NFS mount type directly is successful. 🤔 The error is no such device. I suspect this is related to the addr= NFS mount option.
Setup
- Amazon Linux 2 currently with kernel 4.19.75-28.73.amzn2.x86_64
- ECS optimized AMI having docker 18.09.9-ce
- ECS agent/init 1.36.1
- amazon-efs-utils 1.18
Repro of Failure
- Create your VPC, security groups, NACLs, etc.
- Create an EFS filesystem, encrypted with default key, general purpose, bursting.
- Note the EFS fs id. For writing this repo, I will use
fs-12345678
- Create EC2 instance from an Amazon ECS-optimized AMI
- Create your ECS cluster with that instance. (this step is probably not needed)
- SSH into the EC2 instance
- Create a docker volume
docker volume create \
-d local \
-o "type=efs" \
-o "device=fs-12345678:/" \
-o "o=tls" \
myefs
- Note there is no error.
- Run a docker container that mounts this volume into the container's filesystem
docker run -ti -v myefs:/mnt/one alpine sh
Result
The container does not run ☹ and the below no such device error is given:
docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/myefs/_data': failed to mount local volume: mount fs-12345678:/:/var/lib/docker/volumes/myefs/_data, data: tls: no such device.
Expected
No error. Running container. And the EFS filesystem is mounted into the container's /mnt/one.
Repro of Success with NFS
docker container prune and yes
docker volume rm myefs
- Run
docker volume create \
-d local \
-o "type=nfs" \
-o "device=:/" \
-o "o=addr=fs-12345678.efs.us-east-1.amazonaws.com,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport" \
myefs
- Note no error.
- Run a docker container that mounts this volume into the container's filesystem
docker run -ti -v myefs:/mnt/one alpine sh
Successful Result with NFS
Yay. 👍 You are now in the running Alpine container and the EFS filesystem was successfully mounted to the container's /mnt/one
Please note the params on the volume creation. I used the addr= param instead of putting the DNS on the device.
Repro of FAILURE with NFS
Below is a failure scenario using the typical NFS parameters, where the filesystem DNS is on the device and does not use the addr= parameter. This approach is what appears in the EFS console itself.
docker container prune and yes
docker volume rm myefs
- Run
docker volume create \
-d local \
-o "type=nfs" \
-o "device=fs-12345678.efs.us-east-1.amazonaws.com:/" \
-o "o=nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport" \
myefs
- Note no error.
- Run a docker container that mounts this volume into the container's filesystem
docker run -ti -v myefs:/mnt/one alpine sh
Failure Result with NFS
The container does not run ☹ and the below invalid argument error is given:
docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/myefs/_data': failed to mount local volume: mount fs-12345678.efs.us-east-1.amazonaws.com:/:/var/lib/docker/volumes/myefs/_data, data: nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport: invalid argument.
Expected Result with NFS
No error. Running container. And the EFS filesystem is mounted into the container's /mnt/one.
Hi. I've isolated a scenario where the EFS mount type helper fails to create a docker volume, yet using the NFS mount type directly is successful. 🤔 The error is
no such device. I suspect this is related to theaddr=NFS mount option.Setup
Repro of Failure
fs-12345678docker volume create \ -d local \ -o "type=efs" \ -o "device=fs-12345678:/" \ -o "o=tls" \ myefsResult
The container does not run ☹ and the below
no such deviceerror is given:Expected
No error. Running container. And the EFS filesystem is mounted into the container's
/mnt/one.Repro of Success with NFS
docker container pruneand yesdocker volume rm myefsdocker volume create \ -d local \ -o "type=nfs" \ -o "device=:/" \ -o "o=addr=fs-12345678.efs.us-east-1.amazonaws.com,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport" \ myefsSuccessful Result with NFS
Yay. 👍 You are now in the running Alpine container and the EFS filesystem was successfully mounted to the container's
/mnt/onePlease note the params on the volume creation. I used the
addr=param instead of putting the DNS on the device.Repro of FAILURE with NFS
Below is a failure scenario using the typical NFS parameters, where the filesystem DNS is on the
deviceand does not use theaddr=parameter. This approach is what appears in the EFS console itself.docker container pruneand yesdocker volume rm myefsdocker volume create \ -d local \ -o "type=nfs" \ -o "device=fs-12345678.efs.us-east-1.amazonaws.com:/" \ -o "o=nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport" \ myefsFailure Result with NFS
The container does not run ☹ and the below
invalid argumenterror is given:Expected Result with NFS
No error. Running container. And the EFS filesystem is mounted into the container's
/mnt/one.