Community Note
- Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Problem:
Ephemeral storage for Fargate tasks with readonlyRootFilesystem and a non-root user.
On Fargate platform 1.3.0 this was achievable (in an undocumented/unintentional manner) by configuring a docker local volume at the task level and mounting it to /tmp in each service:
volumes:
- name: "tmpfs"
dockerVolumeConfiguration:
scope: "task"
driver: "local"
...
mountPoints:
- sourceVolume: "tmpfs"
containerPath: "/tmp"
(resulting in a world-writable tmp directory mounted to /tmp/ within the container)
On Fargate platform 1.4.0 docker local volumes are completely unavailable, and the new (officially recommended) way of implementing ephemeral storage for Fargate tasks is using a bind mount [1].
The problem with using a bind mount is that ECS mounts it as writable only by root, so a container running as a non-root user is unable to write any temporary files. Having the container run as root is generally undesirable for security reasons, though practically I expect the impact on ECS is limited since a root-based container escape would just dump an attacker into the ECS host which is presumably heavily sandboxed.
The ideal solution would be for ECS to support configuring permissions on bind mounts, or better still support tmpfs on Fargate [2][3].
[1] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html
[2] #736
[3] #710
Community Note
Problem:
Ephemeral storage for Fargate tasks with readonlyRootFilesystem and a non-root user.
On Fargate platform 1.3.0 this was achievable (in an undocumented/unintentional manner) by configuring a docker local volume at the task level and mounting it to
/tmpin each service:(resulting in a world-writable tmp directory mounted to /tmp/ within the container)
On Fargate platform 1.4.0 docker local volumes are completely unavailable, and the new (officially recommended) way of implementing ephemeral storage for Fargate tasks is using a bind mount [1].
The problem with using a bind mount is that ECS mounts it as writable only by
root, so a container running as a non-root user is unable to write any temporary files. Having the container run as root is generally undesirable for security reasons, though practically I expect the impact on ECS is limited since a root-based container escape would just dump an attacker into the ECS host which is presumably heavily sandboxed.The ideal solution would be for ECS to support configuring permissions on bind mounts, or better still support tmpfs on Fargate [2][3].
[1] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html
[2] #736
[3] #710