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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can modify shm size by passing the optional parameter --shm-size
to docker run
command. The default is 64MB.
eg:
docker run -it --shm-size=256m oracle11g /bin/bash
回答2:
If you use docker-compose to set up your docker environment, it is also possible to set the shared memory in the docker-compose.yml configuration file (since the 3.5 version of the file format):
build:
context: .
shm_size: '2gb'
More info: https://docs.docker.com/compose/compose-file/#shm_size