How to mount EFS

Expected behavior

When the cluster is up i need to mount an efs disk to persistence data. So i need to install some packages like nfs-common…

Actual behavior

I try to install it throw apt-get but this command not found in Moby Linux.

Aditional information

How to i can mount an EFS disk into all instances?

Steps to reproduce the behavior

  1. Access instance with ssh -i “keypair” docker@hostname
  2. Get sudo
  3. Try to install packages

We don’t use a debian based system, so ‘apt-get’ will not be available. We use an Alpine linux based system which uses apk. The base OS that we use is also locked down tightly, so I don’t think it will work even if you get the package installed.

We are hoping to add support for EFS disk mounts in the future, but for now, I’m sorry it isn’t officially supported.

Hi,

There was a link to Japanese website with a Docker wrapper around volume-netshare. I got it, updated and made it usable with a shared mount so you can use it straight away.

https://hub.docker.com/r/cursol/netshare-efs-for-d4aws/

Unfortunately you’ll have to update your template before each stack update.

1 Like

You might want to try the new Cloudstor feature on the beta channel: https://docs.docker.com/docker-for-aws/persistent-data-volumes/

1 Like

I am completely new to Docker, so please bare with me. I am testing based on the Docker for AWS CE version and the link you posted. When I run the example command

docker service create --replicas 5 --name ping1 \
    --mount type=volume,volume-driver=cloudstor:aws,source=sharedvol1,destination=/shareddata \
    alpine ping docker.com

I see that the docker service is created (docker service ls), but I don’t see any docker volumes created (docker volume ls). How do I start the service and create the volume? How do I “log into one of the containers in one swarm node, writing to a file under /shareddata/ and reading the file under /shareddata/ from another container (in the same node or a different node).”?

Sorry for the noobie question and thanks for your help.

I am in the same boat here. Installed docker CE on AWS , and looking for ways to have persistent volumes. I created the EFS on AWS, however since the managers & workers are on Moby Linux. I did the following

apk update && apk add --update nfs-utils && rm -rf /var/cache/apk/*
sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-af4af8e6.efs.us-east-1.amazonaws.com:/ efs

This results in this error.

/home/docker # sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-af4af8e6.efs.us-east-1.amazonaws.com:/ efs
mount.nfs4: Operation not permitted
mount: permission denied (are you root?)

I checked my VPC, security groups etc. to make sure there was nothing going on there. In fact, when creating EFS, I added it to the Docker-VPC (the VPC that gets created by Docker CE). All in vain .

Any help guys ?

I created a separate EC2 instance in the Docker VPC and mounted the GP EFS file system on this instance (i.e. not in any Docker host/container), and I do see the “sharedvol1” folder at the root of my EFS GP file system. However I don’t see “sharedvol1” when I do docker volume ls. I also don’t know how to start a container using the ping service and see the file system mounted at /shareddata. Thanks in advance for any pointers.

Are you using the Edge or Stable template? cloudstor is only enabled by default in Edge today. We will start to pre install it in Stable in an upcoming release.

Great job on this Docker. Yet again you prove to be the gift that keeps on giving. Has this new plugin been integrated into “docker compose” and “docker stack”? I am trying to deploy a stack that has a compose file with the following named volume definition:

volumes:
  user-data:
    driver: cloudstor:aws
    driver_opts:
      source: uservol1
      target: /user/data

Unfortunately I am experiencing a ‘create test_user-data: VolumeDriver.Create: error validating metadata: not a recognized volume driver option: “source”’ error.

You try something like the following if all your tasks in the swarm service can share the same volume.

version: "3"

services:
  stack-app:
    image: alpine
    command: ping docker.com
    volumes:
      - "data_vol:/data"
    deploy:
      mode: replicated
      replicas: 2

volumes:
  data_vol:
    driver: "cloudstor:aws"
1 Like

@ddebroy works great! very much appreciate the guidance!

I am using AWS ECS , how to mount EFS volume for each docker container.

I’m having a smiler issue where Im using the latest 17.06-ce build of docker swarm for aws.
I’m able to deploy an EBS volume but when I try to deploy an EFS volume with the command
docker volume create -d "cloudstor:aws" --opt backing=shared mysharedvol1
i receive the message:
Error response from daemon: create mysharedvol1: VolumeDriver.Create: EFS support necessary for backing type: "shared"
When I deployed the cluster I made sure that cloudstor volumes were enabled

@srinivasn462 please note that the scope of this forum is geared towards the product Docker for AWS: https://docs.docker.com/docker-for-aws/ rather than ECS. That said, you should be able to mount EFS shares in your ECS host and expose them to Docker containers if ECS has a mechanism/CLI to do so. You may get better support on a forum that focusses on ECS.

@yairb Did you check the option Create EFS prerequsities for CloudStor? in the CFN template when you were instantiating it? By default it is set to “No” and needs to be set to “Yes” if you want the EFS set up so that you can use with cloudstor. Also note that you need to be instantiating Docker4AWS in a AWS region that supports EFS (US East (Northern Virginia), US West (Oregon), and EU (Ireland) Regions, Asia Pacific (Sydney), EU (Frankfurt)).

@ddebroy it seems that Frankfurt does not allow creating an EFS volume using cloudstor when I try and do it in Ireland I have no such issue when I try to create an EBS volume I have no such issue in any of the availability zones

Here’s an update list of supported regions:

  • Sydney
  • Frankfurt
  • Ireland
  • North Virginia
  • Oregon
  • Ohio

Did you solved the problem? I have the same problem, I am trying to mount nfs in a moby linux in order to connect to EFS but I am having the same error message.

Hi Guys,
Not sure if this is the right place to ask. I am having an issue with EFS. I could mount and share without issue. However, when I edit a file in EFS, it get stuck. When I check the kernel log it says, NFE server timed out.
Could be a NFS mount options, but I used recommended mount options by AWS. And it is difficult to try out different mount options as I am unable to get into host machine.
Anyone has got a similar situation before?

I’ve been having the same issues. Did you ever solve this? Brand new cloud formation stack (18.09.2), right after I deploy a docker stack that requires an EFS volume, the containers that require the volume hang, and any attempt to mount the volume hangs.