Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

amazon efs - How to mount EFS inside a docker container?

I am trying to mount EFS inside a docker container running on EC2 server. EFS mount in EC2 is working fine with,

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport <efs-address>:/ efs

But when tried in docker container, it is giving error 'mount.nfs4: Operation not permitted'. Please let me know how to achieve this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can create a docker volume using EFS:

docker volume create 
    --driver local 
    --opt type=nfs 
    --opt o=addr=10.0.0.50,rw,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 
    --opt device=:/ efs 

Then mount the volume docker run --rm -it -v efs:/mnt ubuntu:18.04.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...