How to increase the size of the /dev/shm in docker container

五迷三道 提交于 2019-11-29 09:10:13
Lijo Jacob

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

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

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 

Link to source.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!