I'm diving into AWS Fargate for the first time and I've hit a snag. I've got an Nginx container that needs to access files located at /var/www/html, but those files are in a separate PHP app container. Since Fargate doesn't support Docker volumes for sharing files between containers, I'm getting a 'Files Not Found' error. Has anyone successfully figured out how to get containers in Fargate to share files? Here's part of my code for context: I've defined a task with two containers: a server (Nginx) and an app (PHP), and added a volume named 'www-data'. I tried to mount the volume to both containers but it's not working as expected. Any advice would be super helpful!
1 Answer
You might want to consider using AWS EFS (Elastic File System) for sharing files between your containers. It’s designed for exactly this type of use case where multiple containers need access to the same files. Just keep in mind that while it adds a bit more complexity, it's a solid solution for shared storage in Fargate. You just need to set up an EFS file system and mount it to your containers. Good luck!
Isn't that a lot of overhead? And complicated? And an anti-pattern?