Trying to run a wordpress docker container with EFS as the bind mount on an EC2 instance:
version: '3'
services:
wp:
container_name: wp
restart: unless-stopped
image: 123456789.dkr.ecr.us-east-1.amazonaws.com/wp/wordpress:2024.1.3.2
environment:
WORDPRESS_DB_HOST: ${WORDPRESS_DB_HOST}
WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME}
WORDPRESS_DB_USER: ${WORDPRESS_DB_USER}
WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD}
volumes:
- /efs/wp/html:/var/www/html
ports:
- '9090:80'
I have run the following to change the owner / permissions on the directory:
sudo chown -R ec2-user:ec2-user /efs/wp
sudo chmod 777 /efs/wp -R
A few things not working:
- The back-up plugin is not able to restore because of permission issues (writing to /var/www/html/plugins/...)
- The admin panel crashes because FTP is not defined and the permissions issue on the directories is making the write to use FTP
If I change to bind mount to use the volume on the host
- /data/wp/html:/var/www/html
Everything works fine - no permission issues and I can login to the admin panel, restore etc.
I tried this post. I get "operation not supported"
What is it I need to do to be able to use EFS as bind mount so I can have multiple instances running in different availability zones.
Just for completeness - the file system is mounted using the instance profile:
from the
/etc/fstab
fs-123445555:/ /efs efs _netdev,noresvport,tls,iam 0 0