1
votes

I have one Nginx and one WordPress(php-fpm) container declared in ECS Fargate task running on Platform 1.3.0 (or what is marked as LATEST).

I am trying to switch to Platform 1.4.0 for the support of EFS Volumes.

I want Nginx container to serve static assets directly from WordPress container. On 1.3.0 I just bind volumes between containers and everything works. The files from /var/www/html on WP container mapped to `/var/www/html/ on Nginx container.

[
  {
    "name": "wordpress",
    "image": "....",
    ...
    "mountPoints": [
      {
        "readOnly": false,
        "sourceVolume": "asset-volume",
        "containerPath": "/var/www/html"
      }
    ]
  },
  {
    "name": "nginx",
    "image": "....",
    ...
    "mountPoints": [
      {
        "sourceVolume": "asset-volume",
        "containerPath": "/var/www/html",
        "readOnly": true
      }
    ]
  }
]
volume {
  name = "asset-volume"
  host_path = null
}

However, on 1.4.0 instead of mapping folder from WordPress to Nginx, it seems like it creates an empty volume on host and maps that to /var/www/html on both containers thus removing all contents of /var/www/html on WordPress container.

I've been researching that issue for the last couple of days; one solution is to save code to /var/www/code and then copy it to /var/www/html on container runtime, but that seems like a very bad workaround. I wonder if anyone managed to share data from one container to another on Fargate 1.4.0 and how they achieved that.

Thank you

2

2 Answers

3
votes

I had similar issue. Also found the conversation on this topic on Github: https://github.com/aws/containers-roadmap/issues/863

tl;dr; Add VOLUME /var/www/html to you wordpress dockerfile, delete wordpress container definition mountPoints section and in nginx container definition replace mountPoints with volumesFrom.

like this:

    "volumesFrom": [
      {
        "sourceContainer": "wordpress",
        "readOnly": true
      }
    ]
0
votes

please follow this conversation on GitHub:

https://github.com/USACE/instrumentation/issues/88

Ensure dockerfiles for both wordpress and nginx each include the following directive:

VOLUME [ "/var/www/html" ]