简体   繁体   中英

AWS ECS Service for Wordpress

I created a service for wordpress on AWS ECS with the following container definitions

{
  "containerDefinitions": [
    {
      "name": "wordpress",
      "links": [
        "mysql"
      ],
      "image": "wordpress",
      "essential": true,
      "portMappings": [
        {
          "containerPort": 0,
          "hostPort": 80
        }
      ],
      "memory": 250,
      "cpu": 10
    },
    {
      "environment": [
        {
          "name": "MYSQL_ROOT_PASSWORD",
          "value": "password"
        }
      ],
      "name": "mysql",
      "image": "mysql",
      "cpu": 10,
      "memory": 250,
      "essential": true
    }
  ],
  "family": "wordpress"
}

Then went over to the public IP and completed the Wordpress installation. I also added a few posts.

But now, when I update the service to use a an updated task definition (Updated mysql container image)

"image": "mysql:latest"

I loose all the posts created and data and Wordpress prompts me to install again.

What am i doing wrong?

I also tried to use host volumes but to no vail - creates a bind mount and a docker managed volume (Did a docker inspect on container).

So, every time I update the task it resets Wordpress.

If your container needs access to the original data each time it starts, you require a file system that your containers can connect to regardless of which instance they're running on. That's where EFS comes in.

EFS allows you to persist data onto a durable shared file system that all of the ECS container instances in the ECS cluster can use.

Step-by-step Instructions to Setup an AWS ECS Cluster

Using Data Volumes in Tasks

Using Amazon EFS to Persist Data from Amazon ECS Containers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM