问题
I am running a docker image of wordpress on ECS
I am using database as Aurora "name": "WORDPRESS_DB_HOST",
and "value": "db.us-east-1.rds.amazonaws.com"
PROBLEM
If i terminate my ECS instance and run the same task on another ECS instance then the database is not persisting
What i want
The database to persist so that when i run wordpress on another ECS instance i can run the same instance of the wordpress that is i dont have to reinstall or repost or reconfigure any of my posts/settings
What i have done so far
I mounted EFS on var/www/html/wp-content
,What this basically does is persist my wp data only
Question
Is there any way i can make the installation,configuration,log in data etc to persist ? So i can run the task configuration in lets say any ECS instance and then be able to access my wordpress site without setup and reposting all my content ?
回答1:
If you're using an RDS instance, just be sure to add the proper database-related environment variables to the WordPress docker image:
WORDPRESS_DB_HOST=...
WORDPRESS_DB_USER=...
WORDPRESS_DB_PASSWORD=...
WORDPRESS_DB_NAME=...
You can read the full README file for the official WordPress Docker image to understand all the options.
来源:https://stackoverflow.com/questions/60090126/how-to-persist-my-database-in-wordpress-when-running-docker-image-of-wordpress-o