Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Attaching an AWS EFS to Docker Containers

Prerequisites

Practically any Linux operating system
An AWS account with a user whose permissions will allow creating/modifying an EFS
aws-cli terminal application
Docker (cli or Docker Desktop)

Steps

  1. Using the aws-cli, configure your aws account:

    aws configure

  2. Create an Elastic File System volume using the aws-cli:

    aws efs create-file-system --creation-token <insert a name here>

  3. Copy the “FileSystemId” from the output of that command
  4. To create a new container and mount the EFS to it, run:

    docker run -it --name <give it a name> --mount type=volume,source=<file-system-id>,target=/efs,volume-driver=local <docker image you want to use for your container>

  5. You should now be able to type ls in the container’s root directory and see a folder called efs.

    You did it… I think!

Verifying That Nothing Funky Is Afoot…

  • Create a second container (copypasta the docker run command above and change the name).
  • cd into the efs directory.
  • Create a file!

touch just-some-file.txt && ls

  • Verify that the file you just created in container 2 is now also available in the efs directory of container 1.

You actually did it this time! HOORAY!

Troubleshooting (not all-inclusive or guaranteed to work)

  • First double check your AWS EFS security settings/user security policies
  • No luck? Ok, now try installing nfs-utils
  • It still didn’t work? try pip install --user botocore boto3 amazon-efs
  • … Still nothing? Guess ya better ask ChatGPT :D

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors