Skip to content

efs helper fails with "no such device" on Amazon Linux 2 docker volume, yet nfs works #39

@diablodale

Description

@diablodale

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

  1. Create your VPC, security groups, NACLs, etc.
  2. Create an EFS filesystem, encrypted with default key, general purpose, bursting.
  3. Note the EFS fs id. For writing this repo, I will use fs-12345678
  4. Create EC2 instance from an Amazon ECS-optimized AMI
  5. Create your ECS cluster with that instance. (this step is probably not needed)
  6. SSH into the EC2 instance
  7. Create a docker volume
    docker volume create \
        -d local \
        -o "type=efs" \
        -o "device=fs-12345678:/" \
        -o "o=tls" \
        myefs
  8. Note there is no error.
  9. 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

  1. docker container prune and yes
  2. docker volume rm myefs
  3. 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
  4. Note no error.
  5. 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.

  1. docker container prune and yes
  2. docker volume rm myefs
  3. 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
  4. Note no error.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions