How to persist my database in Wordpress when running docker image of Wordpress on ECS?

两盒软妹~` 提交于 2020-02-25 04:11:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!