A workaround to change shared memory size for Docker containers in AWS ECS

Issue

Because of not supporting to specify the following docker run parameter, containers in ECS cannot resize the shared memory.

--shm-size

Solution

Here is a workaround:

1. In order to operate devices with a container, execute docker run command with "--priviledge=true"

2. Run the following scripts with a contianer,

shm_dir=/dev/shm
umount $shm_dir
mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=<size, e.g. 500M, 1G> shm $shm_dir

References

https://bugs.chromium.org/p/chromium/issues/detail?id=519952#c6

https://github.com/aws/amazon-ecs-agent/issues/787

posted @ 2017-12-01 11:47  Anor  阅读(347)  评论(0编辑  收藏  举报