AWS ECS volume permission denied when using non-root Dockerfile

Using the Least Privileged User (and definitely a non-root user) is one of the best practices when working with Dockerfiles. By default, when a Dockerfile does not specify a user, it uses a root user which is almost never a good idea. However, sometimes using non-root users may introduce some hard-to-understand and resolve problems. If you are trying to use AWS ECS fargate non-root containers that have to write to the bind mounts and are seeing the “PermissionError: [Errno 13] Permission denied” error – this is how to solve it.