If you are using Amazon Linux (ECS Optimized), or have installed the Amazon ECS Volume Plugin
you can do the same as @masseyb and @yellowsoar with:
docker volume create efs \
--driver amazon-ecs-volume-plugin \
# example "fs-1234:/" or "fs-1234:/html" to bind an inner folder
--opt device=fs-arn:/ \
--opt o= \
--opt type=efs
or within a Docker Compose:
volumes:
efs:
driver: amazon-ecs-volume-plugin
driver_opts:
device: "fs-arn:/" # example "fs-1234:/" or "fs-1234:/html" to bind an inner folder
o: ""
type: efs