如何增加 docker 容器中/dev/shm 的大小 [英] How to increase the size of the /dev/shm in docker container
本文介绍了如何增加 docker 容器中/dev/shm 的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Currently When I create new docker container the size of the shared memory directory is limited to 64MB. But, I need to increase this size since my application depend on this shared memory. Is there any way to increase the size of /dev/shm in docker container? I heard that the 64MB is hard coded in the docker code, How to install docker from source and change the value of the /dev/shm?
解决方案
If you're using docker-compose, you can set the your_service.shm_size
value if you want your container to use that /dev/shm size when running or your_service.build.shm_size
when building.
Example:
version: '3.5'
services:
your_service:
build:
context: .
shm_size: '2gb' <-- this will set the size when BUILDING
shm_size: '2gb' <-- when RUNNING
这篇关于如何增加 docker 容器中/dev/shm 的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文