'Mount an EBS volume to ECS Task

Use AWS CDK I have an ASG + ECS Cluster & an external EBS Volume created.

df -h
/dev/nvme0n1p1   30G  9.6G   21G  32% /
/dev/nvme1n1    200G  237M  200G   1% /mnt

NOTE: The drive is formatted and mounted by UserData, so should be ready to go before any containers start.

My container starts up using an ENTRYPOINT,

ENTRYPOINT ["/usr/bin/sh", "/opt/startup.sh"]

The container starts fine using startup.sh, but now I want to mount the /mnt directory from the host into the container, how can i do that?

On the same server if i run docker run -p 80:80 -v /mnt:/opt httpd the /mnt directory mounts fine so I need a way to control the ECS task.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source